[英]Empty css file in loading index.php
In a way of divide php code from HTML. 以一种将php代码与HTML分开的方式。 I got a problem in loading css file.
我在加载CSS文件时遇到问题。 So I have php file index.php, css file - main.css,and html files front.html and log_in.html
所以我有php文件index.php,css文件-main.css和html文件front.html和log_in.html
<?php
$door = file_get_contents("log_in.html");
$Page = file_get_contents("Front.html");
$Page = str_replace("{{Door_frame}}", $door, $Page);
echo $Page; // if you know better variant to get page from php please let me know.
?>
Here I try to put the login container in front.html page. 在这里,我尝试将登录容器放在front.html页面中。 I thing it is better to do that create another similar page.
我觉得最好创建另一个类似的页面。
if I go to directory localhost/my-site/ (it automatically take index.php or index.html if i understand correct) it show me the website perfectly. 如果我转到目录localhost / my-site /(如果我理解正确的话,它会自动采用index.php或index.html),它将向我展示完美的网站。 Everything work.
一切正常。 But as soon as I get localhost/my-site/index.php it get me page with empty css file (see the attached pictures).
但是,一旦我获得localhost / my-site / index.php,它就会使我的页面带有空的css文件(请参阅所附图片)。 So the question: why does it happening?
那么问题来了:为什么会这样? Is it not the same address localhost/my-site/ and localhost/my-site/index.php?
它不是同一地址localhost / my-site /和localhost / my-site / index.php吗?
What happens if you enter localhost/site-final/index.php (without / on the end)? 如果输入localhost / site-final / index.php(最后没有/),会发生什么? I think it's trying to load localhost/site-final/index.php/css/main.css when you have index.php/.
我认为当您使用index.php /时,它正在尝试加载localhost / site-final / index.php / css / main.css。 You could use absolute path to your css file ( http://localhost/site-final/css/main.css ).
您可以使用CSS文件的绝对路径( http://localhost/site-final/css/main.css )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.