开发者

Problem setting custom validation rules in Cakephp

I creating a custom validation rule in my cakephp model.

        开发者_C百科'article' => array(
                'rule' => '/^[a-z0-9#.,&; ]{2,255}$/i',
                'required' => true,
                'allowEmpty' => false,
                'message' => 'Alphabets and numbers only(3,255).'
        ),

This works fine. But It stops working, throws a error in model, when I add forward slash [/]. I can't understand why forward causes a problem.

I appreciate any help.

Thanks.


As stated in your other question, read about preg_match() patterns in the php manual. This function is used internally in the framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜