头>
<风格>
</p>
<脚本>
雷雷php代码
echo <<
"记录":[
{"id":"1","name":"新浪","url":"http://www .sina.com"},
{"id":"2","name":"百度","url":"http://www.baidu.com"}
]
}
EOT;
? >
迷茫2017-06-17 09:17:28
添加header('Content-Type: application/json');
让输出的内容是json
<?php
header('Content-Type: application/json');
echo <<<EOT
{
"records":[
{"id":"1","name":"新浪","url":"http://www.sina.com"},
{"id":"2","name":"百度","url":"http://www.baidu.com"}
]
}
EOT;