In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "automatic completion of ThinkPHP3.1 dynamic settings and automatic verification of instance usage". In daily operation, I believe many people have doubts about the automatic completion of ThinkPHP3.1 dynamic settings and automatic verification of instance usage. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "automatic completion of ThinkPHP3.1 dynamic settings and automatic verification of instance usage". Next, please follow the editor to study!
In the past, before the ThinkPHP3.1 version, if you need to set automatic verification or automatic completion, generally speaking, it must be defined in the model, or through the setProperty method to dynamically set properties to complete, the disadvantage is that it is not convenient to dynamically change and adjust.
The ThinkPHP3.1 version adds two coherent operations, auto and validate, to the model class to dynamically set autocomplete and automatic validation rules, which can now be used in Action:
$validate = array (array ('verify','require',' CAPTCHA must!') , array ('name','',' account name already exists!' ,); $auto = array (array ('password','md5',1,'function'), array (' create_time','time',2,'function'),); M ('User')-> auto ($auto)-> validate ($validate)-> create ()
The specification of the $auto and $validate variables is consistent with the definition rules of the _ auto and _ validate attributes of the model class, and can also support function calls (functions cannot be called in the property definition of the class due to the limitations of PHP itself).
The auto and validate methods must be called before the create method.
With this improvement, you can instantiate the model class through the M method and use dynamic settings to complete automatic verification and automatic completion, without having to rely on the D method.
At this point, the study on "automatic completion of ThinkPHP3.1 dynamic settings and automatic verification of instance usage" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.