Can you do a similar test when returning JSON with PHP like mysql_num_rows?
Therefore i can do an IF statement and echo a different piece of text for when there's no JSON available?
Not sure what the context is but you can do
$array = json_decode($json_string);
$num = count($array);
That's if the json_string is an array.
$data = json_decode("some json");
echo count($data);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.