CodeIgniter 2: How to extend CI_Controller multiple times?

前端 未结 5 1076
野性不改
野性不改 2020-12-08 10:38

I have successfully extended the CI_Controller class by creating a MY_Controller.php which I have placed in the application/core directory.

core/My_Controlle

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 11:19

    What you're doing is correct. You just need all of these files in the application/core directory. Here's a post by Phil Sturgeon regarding just this:

    http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY
    http://philsturgeon.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY/

    The trick is to use the __autoload() function - which Phil describes in his post.

提交回复
热议问题