thinkphp5 select对象怎么转数组
2个回答
展开全部
/**
* [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;
}你也可以去后盾人看看php基础教学视频看看,也是不错的选择,希望能帮到你,给个采纳吧谢谢╰(*´︶`*)╯
* [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;
}你也可以去后盾人看看php基础教学视频看看,也是不错的选择,希望能帮到你,给个采纳吧谢谢╰(*´︶`*)╯
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询