开发者

How to include a codeigniter project into another php file?

I have a project based on codeigniter. And I should use one class that extended from a codeigniter controller in 开发者_JAVA百科another php file. But I didn't find the solution about how to teach another php file to see whole CI-project. Beyond that needed class can not inherit when i call it from other place.


I'm not 100% sure if this helps get you in the right direction, but kudos if it does!

Codeigniter routes the application depending on the environment state of the URI. What you need to do is set the environment and include the index view file like so:

$_SERVER["REQUEST_URI"] = "cms/2";

//Set GET action,method params etc
require_once "path/to/index.php";

When you load CI Index file it reads the SERVER Variable and others which you may have to find and execute the controller and method, I would also advise that you modify the library/view file as it may exit upon output causing your script to exit.

Also you may wis hto look into ob_start() to catch the buffer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜