0

我在应用程序文件夹之外的文件中创建了一个控制器。但它会抛出错误致命错误:找不到类'CI_Controller'。谁能告诉我该怎么做?

4

1 回答 1

0

You don't. It either is part of your application or it isn't. Can't have it both ways (not to say it would be impossible to connect, just that why would you?)

If it is a file that looks and works exactly like a controller then why on earth would you take it outside? If you re-route your index.php, then calling your controller's function yoursite.com/controller/function is the same as calling a file that was outside application folder. Suppose you had a folder on root called "controller" and a folder inside it called "function" and an index.php inside of it. You'd call both of them exactly same!

Bottom line: its ok to have 3rd party files outside of application folder, but to have a controller as-is outside of its place simply makes no sense, whatsoever.

于 2013-10-08T23:09:15.383 回答