This is my array. as you notice it has response
because i use it on JSONP
How can get the value of the json using PHP?
this is my code :
foreach ($apiResults['contacts'] as $contact=>$cs) {
foreach ($apiResults['conference_participants'] as $conference_participant=>$c) {
if ($c['name'] == $cs['name']) {
unset($apiResults['contacts'][$contact]);
}
}
}
I'm not yet able to write a comment, so i'll try to write it as an answer. json_decode
will not return a value because your json string is containing callback function response()
which is not a valid json string.
You'll need to remove the callback function name response(
and the trailing )
.
example:
$array = json_decode(substr( $jsonp, 8, -1 )); // $jsonp is your server jsonp response
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.