1

実行時にオブジェクト変数を設定する必要がありますが、動作していますが、PHP は私を返します:

空の値からデフォルト オブジェクトを作成する (/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。$object = new stdClass$object はポインターであるため、使用できません。

4

1 に答える 1

1

解決された、秘密は配列を使用することでした。

$object->test[$tpl_type] =  new template();
$object->$tpl_type = $object->test[$tpl_type];
$object->$tpl_type->setTemplateText($FW_LIST_CONFIGURATION["templates"][$tpl_type]);
于 2011-01-12T16:57:59.020 に答える