Home  >  Article  >  Backend Development  >  关于json_encode()不解

关于json_encode()不解

WBOY
WBOYOriginal
2016-06-13 12:11:28798browse

关于json_encode()困惑

本帖最后由 u013037779 于 2014-12-06 12:07:33 编辑 在控制器里我是这样写的

然后我在一个文本里输出了Json格式是这样的;

可是接收端老提示系统错误,百度了下说是编码不对,可我接收端开头已经写了

并且发送端控制器里也指定了UFT-8编码。
现在接收端就是接受不了数据说是系统错误。。

我用window.alert("ok");能成功
证明数据返回来了,可是错误处在VAR T这里老提示系统错误。。
请问怎么解决啊?
能否提供下代码?
------解决思路----------------------
然后我在一个文本里输出了Json格式是没问题的, 中文使用了utf8编码。在前端javascript代码中增加类似下面的代码:

        data = eval('(' + data + ')');  // 假设收到的内容保存在data中。 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:网站被恶意攻打Next article:YII 的源码分析(2)