在Kendo UI - 教程:使用 Kendo UI 和 PHP 构建应用程序简介 - 第 1 部分中,我了解了如何连接网格。
问题是当 PHP 文件被读取时,它被读取为 HTML 而不是 JSON。解决方法是放置标题。建议的修复是在回显之前在 PHP 文件中指定类型为 JSON。通过添加如下所示的标题:
// add the header line to specify that the content type is JSON
header("Content-type: application/json");
echo "{\"data\":" .json_encode($arr). "}";
我严格遵循该建议,但收到以下错误消息:
警告:无法修改标头信息 - 第 16 行 /home/saulo/public_html/aw001/index.php 中的标头已由(输出开始于 /home/saulo/public_html/aw001/index.php:6)发送
{"data":[{"first_name":"Richard","last_name":"Gere"},{"first_name":"George","last_name":"Clooney"},{"first_name":"Glenda" ,"last_name":"Jackson"},{"first_name":"Lawrence","last_name":"Smith"} 等等...
请帮忙!
我搜索了stackoverflow,但我找不到同样的问题。