我无法识别底部数组的参数。我可以保存参数。
stdClass Object ( [MsgID] => 11604184 [UserID] => 0 [LinkID] => 0 [NumberID] => 0 [Tariff] => 0 [MsgType] => 0 [Body] => Received sms test2. [Udh] => [SendDate] => 2013-06-08T14:30:22.213 [Sender] => 9352175555 [Receiver] => 30001110000011 [FirstLocation] => 1 [CurrentLocation] => 1 [Parts] => 1 [IsFlash] => [IsRead] => 1 [IsUnicode] => [Credit] => 0 [Module] => 0 [RecCount] => 1 [RecFailed] => 0 [RecSuccess] => 0 [IsMoneyBack] => )
stdClass Object ( [MsgID] => 11603241 [UserID] => 0 [LinkID] => 0 [NumberID] => 0 [Tariff] => 0 [MsgType] => 0 [Body] => Received sms test. [Udh] => [SendDate] => 2013-06-08T14:22:43.293 [Sender] => 9352175555 [Receiver] => 30001110000011 [FirstLocation] => 1 [CurrentLocation] => 1 [Parts] => 1 [IsFlash] => [IsRead] => 1 [IsUnicode] => [Credit] => 0 [Module] => 0 [RecCount] => 1 [RecFailed] => 0 [RecSuccess] => 0 [IsMoneyBack] => )
答案 0 :(得分:2)
它不是一个数组,它是一个stdClass对象。
您可以使用以下语法访问对象属性:
echo $obj->MsgID;
或使用类型转换将stdClass对象转换为数组:
$array = (array)$obj;
echo $array['MsgID'];
答案 1 :(得分:0)
如果您需要将stdClass的内容作为数组访问,那么作为问题的解决方案,您可以将对象变量类型转换为数组类型。
E.g $ a =(array)$ object;