Doctypes属于HTML文档,而不是JSON。
在您的PHP文件中尝试这样的操作(仅此操作)
<?phpheader('Content-Type: application/json');?>{"Id":0}鉴于您发布的内容,我什至看不出有任何理由参与PHP。我猜您只是发布了一个非常简单的示例。如果它变得更复杂,包括服务器端处理,数据检索等,请使用PHP的
json_enpre(),例如
<?phpheader('Content-Type: application/json');$data = array( 'Id' => 0, 'foo' => $someOtherComplexVariable);echo json_enpre($data);exit;


