简体   繁体   中英

How execute a controller in a sub-folder using a URL in Codeigniter?

How can I execute a controller ia sub-folder using a URL in Codeigniter?

If I have the next controllers y controllers folder:

-/controllers/
      |---------controller1.php
      |---------/sub-folder/
                     |---------controller2.php

I can execute controller1.php using a URL similar to this: example.com/index.php/controller1/function/param

But, How can I execute controller2.php ?

Very important:

=> make sure your sub folder name is not any of the controller's name

=> make sure your class name and file name is same**

This should work:

 example.com/index.php/sub-folder/controller2/function/param

=> make sure your sub folder name is not any of the controller's name

=> make sure your class name and file name is same

你可以执行

example.com/index.php/sub-folder/controller2/function/param

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