【发布时间】:2019-10-02 00:10:37
【问题描述】:
当我编写我的 .htaccess 文件时,我的项目的 css 和 js 不起作用。我使用 MVC 模式,并且在我的 mainController 中,我每次查看视图时都是 require_once。我不明白,为什么使用 .htaccess 文件程序会尝试 require_once 也是 js。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/(.*)$ index.php?controller=$1&action=$2 [QSA,L]
这是控制台输出:
资源解释为样式表,但使用 MIME 类型 text/html: "".
jquery.min.js:1 Uncaught SyntaxError: Unexpected token bootstrap.min.js:1 Uncaught SyntaxError: Unexpected token
【问题讨论】:
标签: .htaccess model-view-controller path