当前位置:Gxlcms > PHP教程 > json输出的问题

json输出的问题

时间:2021-07-01 10:21:17 帮助过:9人阅读

正确的
{"productInfoMapping":{"asin":"B00F9520K4","binding":"consumer_electronics","dimensionUnit":"cm","dimensionUnitString":"センチメ?トル","encryptedMarketplaceId":"","gl":"gl_pc","height":2.4892,"imageUrl":"https://images-na.ssl-images-amazon.com/images/I/415edkJ88eL._SCLZZZZZZZ__SL120_.jpg","isWhiteGloveRequired":false,"length":23.5966,"link":"http://www.amazon.co.jp/gp/product/B00F9520K4/ref=silver_xx_cont_revecalc","originalUrl":"","productGroup":"","subCategory":"","thumbStringUrl":"https://images-na.ssl-images-amazon.com/images/I/415edkJ88eL._SCLZZZZZZZ__SL80_.jpg","title":"HDMI切替器/セレクタ? 3HDMI to HDMI(メス→オス) 3D?? V1.4( 3入力 to 1出力)","weight":0.0953,"weightUnit":"kilograms","weightUnitString":"キログラム","width":15.6972},"afnPriceStr":1000,"mfnPriceStr":100,"mfnShippingPriceStr":0,"currency":"JPY","marketPlaceId":"A1VC38T7YXB528","hasFutureFee":false,"futureFeeDate":"2015-08-06 00:00:00"}



有问题的
{"productInfoMapping":{"asin":"B00F9520K4","binding":"consumer_electronics","dimensionUnit":"cm","dimensionUnitString":"\u30bb\u30f3\u30c1\u30e1\u30fc\u30c8\u30eb","encryptedMarketplaceId":"","gl":"gl_pc","height":2.4892,"imageUrl":"https:\/\/images-na.ssl-images-amazon.com\/images\/I\/415edkJ88eL._SCLZZZZZZZ__SL120_.jpg","isWhiteGloveRequired":false,"length":23.5966,"link":"http:\/\/www.amazon.co.jp\/gp\/product\/B00F9520K4\/ref=silver_xx_cont_revecalc","originalUrl":"","productGroup":"","subCategory":"","thumbStringUrl":"https:\/\/images-na.ssl-images-amazon.com\/images\/I\/415edkJ88eL._SCLZZZZZZZ__SL80_.jpg","title":"HDMI\u5207\u66ff\u5668\/\u30bb\u30ec\u30af\u30bf\u30fc 3HDMI to HDMI\uff08\u30e1\u30b9\u2192\u30aa\u30b9\uff09 3D\u5bfe\u5fdc V1.4\uff08 3\u5165\u529b to 1\u51fa\u529b\uff09","weight":0.0953,"weightUnit":"kilograms","weightUnitString":"\u30ad\u30ed\u30b0\u30e9\u30e0","width":15.6972},"afnPriceStr":10000,"mfnPriceStr":1000,"mfnShippingPriceStr":0,"currency":"JPY","marketPlaceId":"A1VC38T7YXB528","hasFutureFee":false,"futureFeeDate":"2015-05-05 00:00:00"}



我是通过curl获取的json格式的数据,然后转成数组,再把我要的提取出来,然后转json格式,echo输出那些文字就变了,请问怎么保持原样??


回复讨论(解决方案)

本来就是一样的,只是做了预编码处理
不影响使用,不必要改动

请问我怎么样知道curl我提交的参数是怎么样的??现在老是报失败,都不知道怎么查原因

具体情况要具体分析,你这样泛泛的讲是不能解决问题的

没问题,你说的有问题是json转换之后的

依我之见,楼主可能获取的是一种UTF-8编码的JSON,处理出去的是一种UTF-8预编码的JSON,但显示时却不是用UTF-8编码。

人气教程排行