Common verification rules of Yiirules. The common Yiirules verification rules are forgotten to record the common rules verification rules in Yii. Returnarray (array (email, username, passwor Yii rules common verification rules are required)
Record the common rules verification rules in Yii.
Return array (// you must enter array ('email, username, password, agree, verifyPassword, verifycode', 'required'), // check whether the username already exists in array ('mail ', 'unique', 'message' => 'username occupied '), // maximum character limit for user input array ('email, username', 'length ', 'Max '=> 64), // restrict the minimum length and maximum length of the user array ('username', 'length', 'Max' => 7, 'Min' => 2, 'toolong' => 'User name must be 4-14 characters long ', 'tooshort' => 'User name must be 2-7 characters long '), // restrict the minimum length and maximum length of the password array ('password', 'length', 'Max '=> 22 ,' Min' => 6, 'toolong' => 'Enter a password with a length of 6 to 22 characters, 'tooshort '=> 'Enter a password with a length of 6 to 22 characters '), // Determine whether the email you entered is an array ('email ', 'Email', 'message' => 'email format error '), // check whether the password entered by the user is the same array ('verifypassword', 'compare', 'compareattribute' => 'password ', 'message' => 'Enter the password again '), // check whether the user agrees to the terms of the agreement array ('agree', 'required', 'requiredvalue '=> true, 'message' => 'Confirm that you agree to the privacy agreement clause '), // Determine whether the date format is array ('created', 'date ', 'format' => 'yyyy/MM/dd/HH: mm: s S '), // determine whether to include the input character array ('superuser', 'in', 'range' => array (0, 1 )), // regular expression validators: array ('name', 'match', 'pattern' => '/^ [a-z0-9 \-_] + $ /'), // number validators: array ('id', 'numerical ', 'min' => 1, 'Max' => 10, 'integeronly' => true ), // type verification integer, float, string, array, date, time, datetime array ('created ', 'type', 'datetime'), // File verification: array ('filename', 'file', 'allowempty '=> true, 'types' => 'zip, rar, xls, pdf, ppt ', 'toolarge' => 'image Do not exceed KB), array ('URL', 'file', // is defined as 'allowempty '=> true, 'types' => 'jpg, png, gif, doc, docx, pdf, xls, xlsx, zip, rar, ppt, pptx, // type of the uploaded file 'maxsize' => 1024*1024*10, // upload size limit. Note that it is not php. the upload file size in ini is 'toolarge' => 'the file size is greater than 10 MB. Upload failed! Upload a file smaller than 10 MB! '),);
Articles you may be interested in
- Solution to the DedeTag Engine Create File False error in dedeCMS
- Php uses the filter function to verify the mailbox, url, and IP address
- Graphic tutorial on common basic commands in Unix/Linux
- Php extracts the birthday date from the ID card number and verifies whether it is a minor.
- JS obtains the key code, how Js Shields users' keys, and Js obtains the ASII code corresponding to users' keys (compatible with all browsers)
- Very practical php pop-up error warning function
- Windows cannot start the hardware device because its configuration information (in the registry) is incomplete or damaged. (Code 19) solution
- Thinkphp automatic verification and automatic filling are invalid solutions
Http://www.bkjia.com/PHPjc/995121.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/995121.htmlTechArticleYii rules common verification rules memo Yii more common rules verification rules record, back to seriously study. Return array (// you must enter array ('email, username, passwor...