[英]error json_decode return NULL
i get post arg : 我得到了arg :
//var_dump($_POST['arg']);
{\"username\":\"demo\",\"password\":\"demo\",\"language\":\"7\",\"remember\":\"1\",\"recaptcha_response_field\":\"not torkedSe\",\"recaptcha_challenge_field\":\"03AHJ_VutYReMoMIpG755a_BDrIBquklWRSpf0OmMm_HGaIxCwRH1DFwXU2zdSTEprqGi66rAMd0LaewbcNK12Iir2DQTGAA-DzJZ_jjQQ0WP2JLoG3ANr0HdV3glmovv0B67nqejAj01FrtJA3SaulnTh5q6WwttshJnjBKitI6Np1gejMhIwXQo\"}
but when i get json_decode
, i get NULL
: 但是当我得到json_decode
,我得到NULL
:
$Param = json_decode($_POST['arg'], true);
//var_dump($Param); return NULL
i also check on errors: 我还检查错误:
var_dump($Param,
$error === JSON_ERROR_NONE,
$error === JSON_ERROR_DEPTH,
$error === JSON_ERROR_STATE_MISMATCH,
$error === JSON_ERROR_CTRL_CHAR,
$error === JSON_ERROR_SYNTAX,
$error === JSON_ERROR_UTF8);
and get: 并得到:
NULL
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Tell me please where error? 告诉我哪里出错了?
You have to remove backslashes from string before parsing. 您必须在解析之前从字符串中删除反斜杠。
Also check what json_last_error()
will return. 还检查json_last_error()
将返回什么。 It should help you in the future. 将来对您有帮助。
You said that it's problem with your new server. 您说新服务器有问题。 Check get_magic_quotes_gpc()
. 检查get_magic_quotes_gpc()
。 If it's true, you've found problem. 如果是真的,那么您发现了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.