【问题标题】:cakePHP form errors [closed]cakePHP表单错误[关闭]
【发布时间】:2009-04-30 09:05:56
【问题描述】:

我正在创建一个在 cakephp 中创建的注册表单。 在我看来使用以下代码时

<?php echo $form->create('User', array('url' => array('action' => 'register'))); ?>
<?php echo $form->input('User.name', array('type'=>'text')); ?>
<?php echo $form->end(); ?>

我会遇到这样的错误

$model = "Form"</pre><pre>sprintf - [internal], line ??
FormHelper::hidden() - CORE/cake/libs/view/helpers/form.php, line 1021
FormHelper::create() - CORE/cake/libs/view/helpers/form.php, line 214
    include - APP/views/forms/index.ctp, line 5
    View::_render() - CORE/cake/libs/view/view.php, line 662

帮助我理解问题。

【问题讨论】:

    标签: php forms cakephp


    【解决方案1】:

    这也有效:

    echo $form->create('User', array('action' => 'register'));
    

    【讨论】:

      【解决方案2】:

      试试这个:

      echo $form->create('User', array('url' => '/users/register')); 
      

      【讨论】:

      • 甚至是array('url' => array('controller'=>'users','action'=>'register')); !
      猜你喜欢
      • 2012-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 1970-01-01
      • 2011-08-05
      • 1970-01-01
      相关资源
      最近更新 更多