我綁到這個jsonString傳遞給我的查詢解碼JSON字符串解碼返回null
xxxxxx=createVenue&clientId=2&jsonString={"veneue":{"clientId":"b","name":"d","tagline":"f","phone":"b","address":"d","city":"f","state":"b","zip":"d","twitter":"f","license":"d","imagePath":"f","pickupLocation":"b"},"drinks":[{"type":"d","name":"f","servingTable":{"servingSize":"b","price":"d"}},{"type":"d","name":"f","servingTable":{"servingSize":"b","price":"d"}}],"spirits":[{"type":"d","name":"f","servingTable":{"servingSize":"b","price":"d"}},{"type":"d","name":"f","servingTable":{"servingSize":"b","price":"d"}}]}
但是,當我在PHP解碼它返回null。
$clientId = trim($_REQUEST['clientId']);
$jsonString = trim($_REQUEST['jsonString']);
$decodedJSON = json_decode($jsonString);
return $decodedJSON;
$ decodedJSON返回null;
出了什麼問題?
你有沒有嘗試'urldecode()'之前''json_decode()'? –
提示:*檢查* trim($ _ REQUEST ['jsonString'])'的值(並通過驗證程序運行以確定哪個部分現在無效) – user2864740
什麼是投票的最低點? –