stdClass 객체의 변수를 배열로 가져오기 get_object_vars()
Author : 치치     Date :  2019-12-06 05:18:45   Views : 3회  

You can use get_object_vars method.

$obj = new stdClass();
$obj->field1 = 'value1';

print_r(get_object_vars($obj));

Result:

Array
(
    [field1] => value1
)

 

 

치치(2 months ago)

foreach ($obj as $key => $value) {
    echo "키: $key === 값: $value<br />n";
}

사용만 하려면 이렇게.





❌Delete 🛠Modify 🐣Reply 📄List
No Subject
Author Date Like Views