在PHP中将字符串转换为数组

时间:2019-02-20 12:10:32

标签: php json function api

下面是我的代码,如何获取状态值。

$response="Array ( [balance] => 49993 [batch_id] => 611229481 [cost] => 1 [num_messages] => 1 [message] => Array ( [num_parts] => 1 [sender] => BIZNIS [content] => Hello Sanyam Associates your biznisking registration OTP is 16456.This code will be valid for next 30 minutes ) [receipt_url] => [custom] => [messages] => Array ( [0] => Array ( [id] => 1746281092 [recipient] => 917576955311 ) ) [status] => success )";
$ans=(array)json_decode($response,true);
print_r($ans);     //It is Not Display Anything

echo($response['status']);     //It is Not Display Anything

0 个答案:

没有答案