Files that have both PHP code and HTML code must end with ". PHP".
In order for the PHP interpreter to ignore the HTML code, PHP only processes the contents between a pair of PHP start and end tags.
is ' While the is going to be parsed. ';? ><p>this'll also be ignored by PHP and displayed by the browser.</p>
When PHP encounters the "<?php" tag, it starts parsing, and when it encounters "?>", it ends the parsing. The rest of the code is kept intact.
In this case there is only one PHP start and end tag, and if there are multiple sets of PHP tags, will the code between the two sets of PHP tags remain original?
if true):?> ifistrue. else:?> This'll show. <?php endif;?>
The code above will only output "This would show if expression is true" or "Otherwise this will show", while the other is ignored. You can see that the output PHP will automatically skip the paragraphs that are not reached in the conditional statement.
PHP type start and end flags four different ways of writing:
2 <script language= "PHP" > </script>
3 <? ?>
1 or 22 of these methods are always available.
Mode 3 is a segment marker, Method 4 is ASP style and must be configured in php.ini when used
short_oepn_tag= true supports identifying short marks,
Asp_tags=true support for identifying ASP-style tags
It is generally recommended to use 1 or 2 in order to maintain code portability.
Detach PHP from HTML, write PHP code in HTML