What I did
I used the cakePhp
What happened
When I use $validate in the model file to check the user input, the warning
information like below:
Warning (2): preg_match(): Delimiter must not be alphanumeric or backslash
[CORE\Cake\Model\Validator\CakeValidationRule.php, line 276]
The regular expression does not work.
My environment are PHP 5.4.4, Mysql 5.0.10, apache 2.4.2.
code:
class User Extends AppModel
{
var $name = "User";
public $validate = array(
'username' => array(
'alphaNumberic' => array(
'rule'=>'alphaNumberic',
'require' => 'true',
'message' => 'numberic and characters only'
),
'between' => array(
'rule' => array('between', 9, 18),
'message' => '9-18characters',
)
),
'password' => array(
'alphaNumberic' => array(
'rule'=>'alphaNumberic',
'require' => 'true',
'message' => 'numberic and characters only'
),
'between' => array(
'rule' => array('between', 9, 18),
'message' => '9-18characters',
)
),
'email' => array(
'rule'=>'email',
'message'=>'it is not email'
),
);
} ?>
What I expected to happen
I hope the $validate could work correctly.
<https://lh4.googleusercontent.com/-zk06pjVRaSY/UDX9RHLyV1I/AAAAAAAAADc/uNapTT60Eko/s1600/%E9%94%99%E8%AF%AF%E6%88%AA%E5%9B%BE.jpg>
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.