Php 如何在codeigniter中将数据传递到视图?
我有一个像这样的控制器。它的阵列比此处列出的多:Php 如何在codeigniter中将数据传递到视图?,php,codeigniter,Php,Codeigniter,我有一个像这样的控制器。它的阵列比此处列出的多: $this->data['password'] = array( 'name' => 'password', 'id' => 'password', 'type' => 'password' ); $this->data['password_confirm'] = array( 'name' => 'password_confirm', 'id' => 'p
$this->data['password'] = array(
'name' => 'password',
'id' => 'password',
'type' => 'password'
);
$this->data['password_confirm'] = array(
'name' => 'password_confirm',
'id' => 'password_confirm',
'type' => 'password'
);
使用phil sturgeon模板将此数据传递到视图,如下所示:
$this->template
->title("Edit your Profile")
->set_theme('admin')
->set_layout('dashboard')
->set_partial('links','partials/links')
->set_partial('header','partials/header')
->set_partial('menu','partials/menu')
->set_partial('footer','partials/footer')
->build('auth/edit_user', $this->data);
我的视图文件是:
Password: (if changing password)<br />
<?php echo form_input($password);?>
Confirm Password: (if changing password)<br />
<?php echo form_input($password_confirm);?>
谁能告诉我怎么了??
P.S使用codeingniter hmvc、phil sturgeon template和ben edmunds ion auth…
我做了类似的事情来解决这个问题:
$this->data=数组$this->data然后把它放在$this->template->build前面,试着用这个问题中公认的答案进行调试:这很有帮助
Message: Object of class stdClass could not be converted to string