转化为json方式函数
1,我的数据格式是:
{"message":"","code":0,"data":[{"Order":{"sku":"YA01204","last_updated":"2014-12-10T03:01:29","product_id":"540ac3b8150f190a4e25c576","order_time":"2014-12-09T18:14:18","color":"blue","price":"2.0","shipping_cost":"1.7","shipping":"2.0","ShippingDetail":{"phone_number":"8622681563","city":"Newton","state":"New Jersey","name":"Hector l Ponce","country":"US","zipcode":"07860","street_address1":"9 Foster St"},"order_id":"54873bfa77f07a43b16a0ba4","state":"APPROVED","cost":"1.7","variant_id":"540ac3b9150f190a4e25c57c","order_total":"3.4","days_to_fulfill":"6","product_image_url":"http:\/\/contestimg.wish.com\/api\/webimage\/540ac3b8150f190a4e25c576-normal.jpg","product_name":"New Visible LED Flash Light USB Sync Charger Cable for iPhone 4 4s iPod Touch 4","transaction_id":"54873bf9073c01105cf0ff18","quantity":"1"}},{"Order":{"sku":"PA04401","last_updated":"2014-12-10T03:04:31","product_id":"540ac3ba9fd3f80a4e5a50b0","order_time":"2014-12-09T18:56:36","color":"black","price":"3.0","shipping_cost":"0.85","shipping":"1.0","ShippingDetail":{"phone_number":"5182383320","city":"Cohoes","state":"New York","name":"Gerald Falconio","country":"US","zipcode":"12047","street_address1":"154 Van Schaick
2,我要把这些数据转化为json方式的数组:
$arr = json_decode($pramer);//$pramer 这个就是上面打印出来的一个变量。
当你打印的时候你就可以得到你所想要的数组了。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。