I want to share the contents of my HTML header tag between several pages, but before I use require_once in the HTML header tag, I come across a strange error. Let me explain better.
If I have the following code:
<!DOCTYPE html> <html> <head> <title>Datos Soluciones Informáticas</title> <meta charset="UTF-8"> <link rel="stylesheet" href="/css/main.css"> </head>
and I check the code, everything looks as expected.

However, if I move the contents of the head tag to an external file /snippets/head.php
<meta charset="UTF-8"> <link rel="stylesheet" href="/css/main.css">
And then write the following code in my index.php file:
<!DOCTYPE html> <html> <head> <title>Datos Soluciones Informáticas</title> <?php require_once('/snippets/head.php'); ?> </head>
The check shows that the code is not inserted in the right place:

The problem is not only that the check does not work, but the page does not behave as expected. I have the same problem with include instead of require_once
The original result from the view: localhost in chrome source looks good, but the page doesn't display well
<!DOCTYPE html> <html> <head> <title>Datos Soluciones Informáticas</title> <meta charset="UTF-8"> <link rel="stylesheet" href="/css/main.css"> </head> <body>
I am using Xampp 6.1 Build 7601 on a computer running Windows 7 as my local environment.
Does anyone know what I am missing?
source share