简体   繁体   中英

Empty css file in loading index.php

In a way of divide php code from HTML. I got a problem in loading css file. So I have php file index.php, css file - main.css,and html files front.html and 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. 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. 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). So the question: why does it happening? Is it not the same address localhost/my-site/ and localhost/my-site/index.php?

在此处输入图片说明 在此处输入图片说明

What happens if you enter localhost/site-final/index.php (without / on the end)? I think it's trying to load localhost/site-final/index.php/css/main.css when you have index.php/. You could use absolute path to your css file ( http://localhost/site-final/css/main.css ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM