PHP 배열을 사용하여 무언가를하고 싶습니다. 나는 내가 말할 무언가를 할 수있는 기능을 썼다. 내 입력 배열은 다음과 같습니다.배열을 사용한 특수 작업
Array
(
[0] => stdClass Object
(
[message] => Automated XML Site Map Generator
http://pastebin.com/xjJe38dp
[id] => 103114753133019_371405176303974
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[1] => stdClass Object
(
[message] => Simple but powerful DB class
http://pastebin.com/1qgxUrwX
[id] => 103114753133019_371404696304022
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[2] => stdClass Object
(
[message] => Convert Existing DB to Unicode
http://pastebin.com/pHu08cPs
[id] => 103114753133019_371404609637364
[from] => stdClass Object
(
[id] => 735588533186829
[name] => Mohammad Mostafa Shahreki
)
[created_time] => 2013-04-26
[updated_time] => 2013-04-26
)
[3] => stdClass Object
(
[message] => thanks mosthafa ,,,, for adding me to this group
[id] => 103114753133019_103333343111160
[from] => stdClass Object
(
[id] => 10155092057165556
[name] => HalF PixeL
)
[created_time] => 2011-10-11
[updated_time] => 2011-11-21
)
)
각 데이터를 MySQL 데이터베이스에 저장하고 싶습니다. 예를 들어, 메시지, id, from-> name, created_time을 함수로 저장하고 싶습니다. foreach 루프를 작성하려고했지만 from-> name을 추가하는 방법을 찾을 수 없으며 stdClass이고 [ 'from'] [ 'name']과 함께 사용할 수 없습니다. 내가 어떻게이 일을 할 수 있는지 말해 줄 수 있니?
$array[0]->from->name;
을 그리고 당신의 기능과 같이 보일 수 있습니다 :
-> 이름은 이름은 속성 – Flavio
가능한 중복 - HTTP : //stackoverflow.com/questions/19495068/convert-stdclass-object-to-array-in-php – Harshit
안녕하세요. 나는 그런 배열을 가지고있다 !!!! 내가 그 근처에서 서로를 사용할 수 없다는 걸 알다시피. 어떻게해야합니까? – simba