首页 > php取出json值?

php取出json值?

"order":{"result": "true", "arrive": "true", "first_fee": "12.00", "continue_fee": "8.00",…}

我想把order去掉 取出里面的值 我该怎么办?


1.麻烦的办法

使用正则匹配,极其不建议

2.把json转成数组

$array = json_decode($json_str, true);

这样子,这样就好看很多啦~

$new_json_str = json_encode($array['order']);

这样 $new_json_str 即是去掉order之后的新json串了。

【热门文章】
【热门文章】