我用jquery获取一个php页面返回的json对像
但把php页面上加的
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
也一起当文本给返回过来了
这样json对象前面就是那标签字符串
用js evel转换对象的时候老是报错
就只能先把前面的那串标签给截取掉才能正确转换
我想知道怎么才能不把那串标签给返回过来
遇到过的朋友解决下
先谢了
但把php页面上加的
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
也一起当文本给返回过来了
这样json对象前面就是那标签字符串
用js evel转换对象的时候老是报错
就只能先把前面的那串标签给截取掉才能正确转换
我想知道怎么才能不把那串标签给返回过来
遇到过的朋友解决下
先谢了
设置header
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
echo "{type:1}";
不能加其它东西
我在返回数据的数据也添加了<meta http-equiv="Content-Type" content="text/html; charset=big5" /><?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
echo "{type:1}";
?>但是页面设置的meta也会返回过去
<?php 这标签上面的几个换行,也会当成字符给返回过去
这种情况怎么办
再帮帮忙
谢了
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: text/html; charset=big5"); //编码及内容类型头信息加在这里
echo "{type:1}";
?>
不加<meta http-equiv="Content-Type" content="text/html; charset=big5" />
的话
打出来的字都会被保存为utf8的编码
然后就变乱码了
不会是每次要调试json的时候
再把<meta http-equiv="Content-Type" content="text/html; charset=big5" />
给删除掉吧
找位置也比較方便
以前寫其他的也是只用EditPlus