创建webservice后,我的JSON响应如下
$response['success']=1;
$response['message']='enter successfully';
die(json_encode($response));
但是当我在iOS应用程序中运行这个时,会出现如下错误
JSON文本没有以数组或对象开头,并没有设置允许片段的选项
您的json响应无效。请检查json对象
尝试以下代码:
header('Content-Type: application/json');
$response['success']=1;
$response['message']='enter successfully';
print json_encode($response);
exit();