CodeIgniter Controller Controllers Succession problem example analysis, CodeIgniter controller _php Tutorial

Source: Internet
Author: User
Tags codeigniter

CodeIgniter controller Controllers Inheritance Problem example analysis, CodeIgniter controller


This paper describes the controller succession problem of CodeIgniter controllers. Share to everyone for your reference, as follows:

In the project often used in such a situation, each page in the background to determine whether the user login status. For CodeIgniter, it is considered that each controller inherits a common controller.

For example: Adminbase for the application of the background of the common controller, in each application back-end controller to inherit the public adminbase, but also to ensure that Adminbase is also inherited Ci_controller.

The front desk homebase is the same thing.

The implementation is very simple, as long as the application/core below the new my_controller.php, as follows
(My_ is a configurable, application/config/config.php file and finds this: $config [' subclass_prefix '] = ' my_ ';)

Class My_controller extends Ci_controller{function __construct () {parent::__construct ();}} Class Adminbase extends My_controller{function __construct () {parent::__construct ();.} ......} Class HomeBase extends My_controller{function __construct () {parent::__construct (); ......}

And then the controller inside the application/controllers can inherit, like in application/controllers/admin/blog.php.

Class Blog extends Adminbase{function __construct () {parent::__construct (); ......}

For more information on CodeIgniter framework related content readers can view this site topic: "CodeIgniter Introductory Tutorial"

It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.

Articles you may be interested in:

    • A tutorial to implement read-write separation in MySQL usage
    • The method of realizing the master-slave reading and writing separation of Yii
    • thinkphp implementing MySQL read-write detach operation example
    • MySQL read-write separation using PHP
    • SQL SERVER2005 Implementation of database read-Write separation introduction
    • MySQL master-slave synchronization, read and write separation configuration steps
    • MySQL read/write separation (actual combat)
    • MySQL read/write separation (Basic article)
    • Example analysis of session usage of CodeIgniter configuration
    • Example analysis of routes.php usage of codeigniter configuration
    • CodeIgniter Read and write separation implementation method detailed

http://www.bkjia.com/PHPjc/1093702.html www.bkjia.com true http://www.bkjia.com/PHPjc/1093702.html techarticle CodeIgniter Controller Controllers Succession problem analysis, CodeIgniter controller This paper describes the CodeIgniter controller succession problem. Share to everyone for your reference, specific ...

  • 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.