This time to do a project: using thinkphp to do an automatic verification, but found that if the new time, can be automatically verified, but in the modification of the changes, you will find that the automatic validation will be invalidated.
When validating, the model is written like this:
protected $_validate Array ( array(' title ', ' Require ', ' title cannot be empty! '), array(' title ', ' ', ' title already exists! ', 0, ' unique ', 1), array(' name ', '/^[a-za-z]+$/', ' identity not plain English ', 1), array(' name ', ' Require ', ' The logo cannot be empty! '), array(' name ', ' ', ' identity already exists! ', 0, ' unique ', 1),);
This says: No problem at all. But a closer look will reveal that when adding an operation, the title verifies that the unique/name validation is English and unique. However, when modifying the operation, it will be found that he will not verify the unique. That is, when you modify it, you can change it to the same field.
To verify when adding and modifying:
protected $_validate Array ( array(' title ', ' Require ', ' title cannot be empty! '), array(' title ', ' ', ' title already exists! ', 0, ' unique '), array(' name ', '/^[a-za-z]+$/', ' identity not plain English '), array(' name ', ' Require ', ' The identity cannot be empty! '), array(' name ', ' ', ' identity already exists! ', 0, ' unique '),);
thinkphp---Auto-validation issues