0

I ran into a problem when working with PHP buffer. The essence of the problem: when you connect an HTML file in which there is a CSS file connection, CSS is not displayed on the page. I double-checked the code, and through the inspector of the elements, too - in the browser this CSS file is opened by reference without any problems, the paths are correct. I was looking for a problem with Google but I didn’t find anything.

    ob_start();
    require $filePath;
    ob_get_flush();

and required files.

    <link rel="stylesheet" href="<?= ROOT ?>css/main.css">
6
  • ob_get_flush(); probably retunrs the string, but your code doesn't do anything with it. Try echo ob_get_flush(); or assign to variable and check its value other way. Commented Apr 5, 2020 at 13:53
  • shudder, due to echo, the contents are called twice. CSS is still not output. Commented Apr 5, 2020 at 14:16
  • How do you know contents are called twice? You said nothing is displayed. Commented Apr 6, 2020 at 4:57
  • i mean nothing from CSS... Page is displayed WITHOUT CSS styles, but CSS included correctly. Commented Apr 6, 2020 at 13:39
  • So html response contains correctly included line with stylesheet directive? That means php works fine. Make sure your ROOT translates to absolute path to the file (with domain and https if you use one). Check network response to css request in browser's developer tools (F12 usually). Also look at answers to this question Commented Apr 6, 2020 at 16:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.