How can I assign client_id to a variable in my php script?
{
"success": true,
"client_id": "14",
"call": "addClient",
"server_time": 1323785423,
"info": [
"New client account created"
]
}
How can I assign client_id to a variable in my php script?
the following is the command i used to generate the above json output.
$return = HBWrapper::singleton()->addClient($params);
and I used return in a foreach loop.
foreach ($return as $id) {
echo $id->client_id;
}
Problem is you're trying to directly access the string without converting it, referencing it as an object can be achieved with json_decode($string)
$return = json_decode(HBWrapper::singleton()->addClient($params));
foreach ($return as $id) {
echo $id->client_id;
}
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.