这是我的文件结构:你可以在这里或看到它
-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)