How are we going to verify this? Validate once in every action? Or is it written in a public function called?
Reply to discussion (solution)
It's usually called.
But that's what I'm doing now. Log in and save the cookie with the PHP file or a specific location to verify the existence of this cookie
It's usually called.
But that's what I'm doing now. Log in and save the cookie with the PHP file or a specific location to verify the existence of this cookie
Well, that's OK. Just feel the trouble. In the common general function, I add the method of validating the user, by judging the values of A and m, whether to invoke the method of validating the user. But because I added a verification code in the login interface, a call, the verification code will not come out. Want to find a more convenient way.
Can write a public class inheritance
In general, I do this:
Class Baseaction extends action{ function _initialize () { if (!in_array (model_name. ') _'. Action_name,explode (', ', ' public/login,public/loginon,public/verify ')) { if (!isset ($_session[' login])!! Empty (Session (' login '))) $this->redirect ("/login");}}}
Maybe the code is wrong, huh?
In general, I do this:
Class Baseaction extends action{ function _initialize () { if (!in_array (model_name. ') _'. Action_name,explode (', ', ' public/login,public/loginon,public/verify ')) { if (!isset ($_session[' login])!! Empty (Session (' login '))) $this->redirect ("/login");}}}
Maybe the code is wrong, huh?
Kazakhstan, this is feasible, just tried, and did not think that the verification code is actually called a model under the action. The code is a little bit wrong, "_" should be replaced by "/".