404 在 LAMP 上使用 Codeigniter 3,但在 MAMP 上工作



我在CI3上开始了一个新项目。 我用 MAMP 在我的 MB 上开发了它。一切正常!

今天下午我尝试在我的虚拟机服务器(Ubuntu 18.04,php 7.2.19)上发布代码。 欢迎页面效果很好,但无法使用路由。

localhost/index.php -> good
localhost/index.php/push/ -> 404 ( still working on MAMP )

我尝试使用 .htacces,在路由器.php文件中创建一个路由,....

/application/controllers/api.php :

class Push extends REST_Controller{

public function _construct(){
....
}

public function index_post(...){
...
}
}

始终是仅在灯上找不到的 404

问题是Mac OS不区分大小写,但Linux操作系统区分大小写。CodeIgniter 要求文件和类名完全匹配,并且它们的名称中的第一个字符为大写,所有其他字符均为小写。在不区分大小写的系统上,您可以忽略该约定,但在区分大小写的系统上,您不能。

顺便说一句,控制器、模型和库区分大小写。本质上,任何定义 PHP 类的文件。

相关内容

最新更新