简体   繁体   中英

Operator (.) changes PHP tags to comment

At start: $template = file_get_contents('xyz .php(cache) or .tpl');

Now I want to: $template .= "<?php echo 'test'; ?>";

In cache it's: <?php echo 'test'; ?> <?php echo 'test'; ?> Now I echo $template;

And in browser it changes to: <!--?php echo 'test'; ?--> <!--?php echo 'test'; ?--> Someone know why?

You are outputting PHP code to the browser but PHP code is invalid HTML and needs to be executed on the server.

The browser is trying to error recover and converts it to a comment when it tries to parse it as HTML.

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