tp3.2.3 controller inheritance related issues-don't understand

Source: Internet
Author: User
tp3.2.3 controller Inheritance Issues-I don't understand.
For example, to login to verify, I used to use the TP3.1.2 version, directly create a new Conn controller class, and then use this conn class to inherit the action class, the Conn class with _initialize () {} to implement the validation settings, If no session is adjusted to the login controller to log in, other classes that need to be validated inherit Connaction.class class, but in 3.2.3 This version I don't know how to use, I found a pre-control method _before_index () But this method can only be used in a single controller, how to use the global?
------to solve the idea----------------------
Make a judgment login or not class inherit Controller other ways to inherit your class
Then there is a login page that also inherits the Controller

Similar


Class Basecontroller extends Controller
{

Public Function _before_index ()
{

------to solve the idea----------------------
Session ('? username ') = = FALSE) {
$this->redirect ('/index.php/home/login/index ');
Exit
} else {
}


}

}

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.