本篇文章给大家带来的内容是关于thinkphp5编辑时验证唯一如何解决? 有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
若定义了相关的验证规则,如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
在添加界面验证的时候,提交自身的数据验证正常。
然而在编辑修改的页面验证时,提交自身数据会提示数据重复。
解决方法:
在编辑页面表单把主键id也作为数据传入到验证器中(name要和主键同名)。如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
The above is the detailed content of How to solve the problem of unique verification when editing in thinkphp5?. For more information, please follow other related articles on the PHP Chinese website!