偶尔的错误解码JSON字符串 [英] Occasional error decoding a JSON string

查看:131
本文介绍了偶尔的错误解码JSON字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的服务器。

I have two different servers.

在第一位的,我的开发服务器,一切正常,他们应该。在第二个,我的生产服务器,我得到了几个错误,我不知道如何解决。

In the first one, my development server, everything works as they should. On the second one, my production server, I get a couple of errors I don't know how to address.

在后者,我一直当json_de code'ing字符串收到一个错误。当试图查明错误,我发现如下:

On the latter, I keep getting an error while json_decode'ing a string. When trying to pinpoint the error, I found the below:

在我的开发服务器上,当我的var_dump POST数据,我得到:

On my development server, when I var_dump the POST data, I get:

'data' =>
    string(96) "{"id":null,"codigo":55,"nome":"testa","coordenador":"testa","financiadora":"testa","ativo":true}"

而我的生产服务器上,我得到:

Whereas on my production server, I get:

["data"]=>
    string(113) "{\"id\":null,\"codigo\":4,\"nome\":\"teste\",\"coordenador\":\"teste\",\"financiadora\":\"teste\",\"ativo\":true}"

}

我大概可以剥掉反斜线在我的生产服务器,但我不希望有两个不同的codeS。我不明白为什么它的发生。

I could probably strip the backslashes in my production server, but I don't want to have two different codes. I also don't understand why it's happening.

它是一个Apache / PHP配置问题?我该如何解决?

Is it an Apache/PHP configuration issue? How do I address that?

完全相同的code,相同的数据库的两个服务器。

Exact same code, exact same database in both servers.

推荐答案

听起来像是你的生产服务器有魔术引号启用。 关闭它和问题应该消失。

Sounds like your production server has Magic Quotes enabled. Turn it off and the problem should disappear.

这篇关于偶尔的错误解码JSON字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆