简体   繁体   中英

How to extend My custom library to my controller

I want my Custom_library class extend to My_custom_controller . Is it possible?

If you want to extend simply extend:

class xyz extends utv
{
    //class code here
}

But I advise you to load library in constructor to private $var in your controller

class My_custom_controller
{
    private $libs;
    public function __construct()
    {
         $this->libs = new Custom_library();
    }
}

I advise you that becouse you really don't want to extend library in controller, you can override something by accident, that way you will have access to library and you will be shure that nothing wrong goes with your library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM