这是我的文件结构: 你可以在这里看到它或者
-resources/
--css/
---index.css
-src/
--views/
---main.view.php
--main.php
index.php
.htaccess
这是我的.htaccess:
RewriteEngine On
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
这就是我在视图中包含 CSS 的方式
<link rel="stylesheet" href="resources/css/index.css">
问题:当我在 index.php 中包含 main.php(包括视图)时,无论我将 index.css 放在哪里,CSS 都不起作用。任何提示?
您需要添加规则以排除重写资产
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句