您提交的JSON数据无效JSON。
当您在外壳中使用’时,您将怀疑它不会处理“。
curl -v --header 'content-type:application/json' -X POST --data '{"content":"test content","friends": ["38383","38282","38389"],"newFriends":0,"expires":"5-20-2013","region":"35-28"}'可以正常工作。
<?php$foo = file_get_contents("php://input");var_dump(json_depre($foo, true));?>输出:
array(5) { ["content"]=> string(12) "test content" ["friends"]=> array(3) { [0]=> string(5) "38383" [1]=> string(5) "38282" [2]=> string(5) "38389" } ["newFriends"]=> int(0) ["expires"]=> string(9) "5-20-2013" ["region"]=> string(5) "35-28"}

![PHP解码JSON POST [关闭] PHP解码JSON POST [关闭]](http://www.mshxw.com/aiimages/31/616895.png)
