thinkphp5 select对象怎么转数组
1个回答
展开全部
/**
* [std_class_object_to_array 将对象转成数组]
* @param [stdclass] $stdclassobject [对象]
* @return [array] [数组]
*/
function std_class_object_to_array($stdclassobject)
{
$_array = is_object($stdclassobject) ? get_object_vars($stdclassobject) : $stdclassobject;
foreach ($_array as $key =>$value) {
$value = (is_array($value) || is_object($value)) ? std_class_object_to_array($value) : $value;
$array[$key] = $value;
}
return $array;
} 你看过后很简单吧以后不会可以向我一样经常到后盾人找找相关教材看看就会了,希望能帮到你,给个采纳吧谢谢
* [std_class_object_to_array 将对象转成数组]
* @param [stdclass] $stdclassobject [对象]
* @return [array] [数组]
*/
function std_class_object_to_array($stdclassobject)
{
$_array = is_object($stdclassobject) ? get_object_vars($stdclassobject) : $stdclassobject;
foreach ($_array as $key =>$value) {
$value = (is_array($value) || is_object($value)) ? std_class_object_to_array($value) : $value;
$array[$key] = $value;
}
return $array;
} 你看过后很简单吧以后不会可以向我一样经常到后盾人找找相关教材看看就会了,希望能帮到你,给个采纳吧谢谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询