我有一个返回的数组:
Array (
[0] => stdClass Object (
[webinarKey] => 635595402
[subject] => Messages
[description] => This webinar is open to practicing clinicians only. If not a practicing
clinician, seek permission from Sun Nuclear prior to registering. Any views, findings, or
recommendations expressed in this presentation are solely those of the guest speaker, and do
not necessarily represent those held by Sun Nuclear. Please contact Sun Nuclear to verify any
claims or request further information.
[organizerKey] => 1.0000000000131E+17
[times] => Array (
[0] => stdClass Object (
[startTime] => 2014-11-21T14:00:00Z
[endTime] => 2014-11- 21T15:00:00Z )
)
[timeZone] => America/New_York
)
如何选择 [subject] 和 [description] 并将数据插入数据库表?
答案 0 :(得分:0)
尝试
$array = get_object_vars($your_data);
$subject = $array['subject'];
$description = $array['description'];
然后您可以将这些变量保存到数据库等。
答案 1 :(得分:0)
您可以执行foreach()
$subject = '';
$description = '';
foreach($array as $item){
$subject = $item->subject;
$description = $item->description;
// Save it into the db or store it into a variable to save after the loop ends
}