我正在尝试以 json 格式获得正确的输出,但下面的输出有点混乱。它应该是这样的:
"{"table":"users","operation":"select","username":"inan"}"
我该如何解决我的问题?
谢谢
服务器.php
print_r($_POST);
客户端.php
$data = array('table'=>'users', 'operation'=>'select', 'uid'=>'yoyo');
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($curl_handle);
if ($this->request_response_type == 'array')
{
echo $output;
}
else if ($this->request_response_type == 'json')
{
echo json_encode($output);
}
else if ($this->request_response_type == 'xml')
{
//xml conversion will be done here later. not ready yet.
}
输出:
"Array\n(\n [table] => users\n [operation] => select\n [uid] => yoyo\n)\n"