开发者

Creating default object from empty value

开发者 https://www.devze.com 2023-02-04 08:46 出处:网络
I need to set the object variable at run time, it is working, but PHP returns me: Creating default object from empty value (/sct/fw FW_List.class.php:1142)

I need to set the object variable at run time, it is working, but PHP returns me:

Creating default object from empty value (/sct/fw FW_List.class.php:1142)

function initTemplates(&$object, $tpl_names)
{

 global $FW_LIST_CONFIGURATION;
     $is_custom = array();

     foreach($tpl_names as $tpl_type) {
        $object->$tpl_type =  new template();
        $object->$tpl_type->setTemplateText($FW_LIST_CONFIGURATION["templates"][$tpl_type]);
            // place the defauts template values
        $object->$开发者_如何转开发tpl_type->setPlace( $FW_LIST_CONFIGURATION["css"][$tpl_type]);
  }
  return $is_custom;
}

ps. i can't use $object = new stdClass, because $object is a pointer.


resolved, the secret was to use Array;

$object->test[$tpl_type] =  new template();
$object->$tpl_type = $object->test[$tpl_type];
$object->$tpl_type->setTemplateText($FW_LIST_CONFIGURATION["templates"][$tpl_type]);
0

精彩评论

暂无评论...
验证码 换一张
取 消