E
E
Eugene2020-05-14 10:44:00
PHP
Eugene, 2020-05-14 10:44:00

Why does the browser see PHP code as a comment?

A strange situation has arisen. I decided to write, for my needs, a mini engine for the site. I don’t want to learn from the framework right away or use someone else’s solutions. Just for study, nothing top secret. Essentially a couple of template pages, a main page and a class for displaying pages. But I ran into such a trouble, on the main page the PHP code works fine, but on the secondary pages it doesn’t work at all. A stupidly empty page with one line of HTML and one output from phpinfo() only outputs HTML.
In development mode, the browser displays my PHP code like this:

<!--?php
phpinfo();
?--> ==$0

I already thought that I messed up with HTML tags somewhere, maybe I didn’t close it somewhere, because I use separate footer and header files, but I already checked everything. What could be wrong?
Everything works in index.php, files are connected, an object is created, page switching works. Only here on these pages the code no longer works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-05-14
@FanatPHP

Because kids raised by YouTube don't know how to google
. You copy the URL of a page that PHP works on and one that doesn't.
You paste into a clean file in the editor one under the other.
Looking for 10 differences

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question