json_encode
和json_decode
有一个奇怪的行为,我找不到解决办法:
我的php应用程序调用php web服务.Web服务返回如下所示的json:
var_dump($foo):
string(62) "{"action":"set","user":"123123123123","status":"OK"}"
现在我想在我的应用程序中解码json:
$data = json_decode($foo, true)
but it returns NULL
:
var_dump($data):
NULL
I use php5.
The Content-Type of the response from the webservice: "text/html; charset=utf-8"
(also tried to use "application/json; charset=utf-8"
)
What could be the reason?