我正在研究 wamp。 我网站的链接是:localhost/tshirtshop/
重写之前是:localhost/tshirtshop/index.php?product=12
改写后为:localhost/product-title-p12
问题: 一切正常。但问题在于 Css 文件。
这个文件不包括..当我看到源代码(Ctrl+U)时,路径是这样的:
localhost/tshirtshop/product-title-p12/styles/tshirtshop.css
我尝试了什么:
我试过了
<style>
<?php include 'styles/tshirtshop.css';
</style>
它有效,但对我来说不是解决方案。因为还有一些其他图像也包括在内,即 Logo 结果为这条路径: 本地主机/tshirtshop/product-title/images/tshirtshop.png
这可能是一个非常简单的解决方案。但是我从一个小时开始就面临问题。我尝试用谷歌搜索类似的问题,但没有找到任何问题。所以请不要介意。对不起我的英语。
最佳答案
像这样使用绝对路径
<link rel="stylesheet" type="text/css" href="http://localhost/tshirtshop/styles/tshirtshop.css" />
关于php - Css 包括在 PHP 中实现 modrewrite 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24855977/