-1
我的php文件在浏览器中正常工作。php返回源代码而不是json字符串
$array = array("message" => "Not found", "status_code" => 404);
echo json_encode($array);
这个作品
echo file_get_contents("http://localhost/file.php");
但它返回的源代码时,我仅使用文件名
echo file_get_contents("file.php");
响应
"Not found", "status_code" => 404); echo json_encode($array);