cakephp验证字母表问题

时间:2015-08-05 09:37:22

标签: php cakephp

我已经验证了下面代码中的字母字段,但它不起作用..

<?php
    class User extends AppModel {
      public $name = 'User';
      public $displayField = 'name';

      public $validate = array(
          'firstname'=>array(
              'Please enter your firstname.'=>array(
                  'rule'=>'[a-zA-Z]+',
                  'message'=>'Please enter your firstname.'
              )
          ),
?>

有人可以帮助吗

1 个答案:

答案 0 :(得分:0)

你还没有结束你的阵列和你的课程,这很可能是个问题。

<?php
    class User extends AppModel {
      public $name = 'User';
      public $displayField = 'name';

      public $validate = array(
          'firstname'=>array(
              'Please enter your firstname.'=>array(
                  'rule'=>'[a-zA-Z]+',
                  'message'=>'Please enter your firstname.'
              )
          )
      );
    }
?>