0
這個工程通過json_encode():難同當選項作爲變量
$text = "hullo world";
$display = json_encode($text, JSON_NUMERIC_CHECK);
返回:
"hullo world"
這不起作用:
$text = "hullo world";
$options = "JSON_NUMERIC_CHECK";
$display = json_encode($text, $options);
返回:
Warning: json_encode() expects parameter 2 to be long, string given in /pathtomyscript/myscript.php on line 11
我正在運行PHP 5.3.3,據我所知,它不支持新版本支持的所有json_encode選項,但爲什麼當這個選項作爲變量傳遞時,這個失敗呢?
其他選項的值具有相似的結果。
我想你混淆了你的例子,因爲第二個是正確的。 –
抱歉,是的,現在會修復 – AllInOne