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