Session 如何从会话中填充输入?

Session 如何从会话中填充输入?,session,cakephp,Session,Cakephp,我试图在Cake PHP3上开发一个简单的编辑表单,我想从会话中填充它们 我该怎么做 编辑.ctp: <br> <div class="index large-4 medium-5 large-offset-4 medium-offset-4 columns"> <div class="panel"> <h2 class="text-center">Edit</h2> <?= $this-

我试图在Cake PHP3上开发一个简单的编辑表单,我想从会话中填充它们

我该怎么做

编辑.ctp:

<br>
<div class="index large-4 medium-5  large-offset-4 medium-offset-4 columns">
    <div class="panel">
        <h2 class="text-center">Edit</h2>
        <?= $this->Form->create(); ?>

            <?php $nome = $this->request->session()->read('Auth.User.nome');

            echo  $this->Form->input('nome', array('id' => 'nome'), array('value' => $nome)); ?>
            <?= $this->Form->input('email' ,array('id' =>'email')); ?>
            <?= $this->Form->input('password', array('type' => 'password'), array('id' => 'password')); ?>
            <?= $this->Form->submit('Alterar', array('class' => 'button')); ?>

        <?= $this->Form->end(); ?>
    </div>
</div>      

编辑
与编辑操作相同,只需将id指向验证用户id

public function edit(){
     $id = $this->Auth->user('id');
     $user = $this->Users->get($id);
     //rest of your code here
}
替换

$this->Form->input('nome', array('id' => 'nome'), array('value' => $nome));

标准的cakephp表单输入语法是

Cake\View\Helper\FormHelper::input(string $fieldName, array $options =[])

请检查其他字段。

您的问题是,您没有获得授权名称或无法应用编辑?是你的名字还是名字?问题已经解决了。谢谢它起作用了!非常感谢你!我是CakePHP新手。再次感谢!
Cake\View\Helper\FormHelper::input(string $fieldName, array $options =[])