我有一个JS文字对象字符串,如{name:{first:“George”,middle:“William”},姓:“Washington”},我必须在Json中将其转换.我怎么能用
PHP做到这一点?
JS:
原文链接:https://www.f2er.com/php/136278.html// Pretend we're POSTing this var foo = {foo:{first:"George",middle:"William"}};
PHP:
$foo = $_POST['foo']; $foo = json_decode( stripslashes( $foo ) ); echo $foo->first;