1

我有一个像这样的控制器。它的数组比此处列出的要多:

$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);?>

现在,当我刷新页面时,我会在字段中获取值,但在页面顶部也会出现错误消息:

Message:  Object of class stdClass could not be converted to string

谁能告诉我怎么了??PS 使用 codeingniter hmvc、phil sturgeon 模板和 ben edmunds ion auth....

4

1 回答 1

0

我做了类似于以下的事情来解决这个问题:

$this->data = (array) $this->data;

并将其放在前面$this->template->build()

于 2013-03-27T02:27:22.540 回答