0

コントローラーからコンストラクターに変数を渡すにはどうすればよいですか?

 function __construct()
{

    parent::__construct();

    $info['title'] = 'No title';
    $this->load->view('include/header',$info);
}


function be_cool()
{

    $info['body'] = 'template/becool';
    $info['title'] = 'This is the be cool title';

    $this->load->view('include/template',$info);
}

function be_hot()
{

    $info['body'] = 'template/behot';
    $info['title'] = 'This is the be hot title';

    $this->load->view('include/template',$info);
}

コントローラーで定義された値に基づいてタイトルを変更しようとしています。しかし、それは機能していないようです。私は何が間違っているのですか?

4

1 に答える 1

0

構文エラーがあります。あなたのbe_cool()方法では:

$$his->load->view('include/template',$info);

する必要があります

$this->load->view('include/template',$info);

また、他の方法で$hisある必要があります。$this

于 2012-11-26T18:02:46.447 に答える