PHP Document composition
Html/xhtml Mark
CSS Styles
Client-side scripting (such as JavaScript, jquery, etc.)
Server script: <?php echo date (' y-m-d ')?>
A PHP file must contain server scripts, but not necessarily other types of code.
PHP syntax
When parsing a file, the PHP engine looks for the fact and end tag, which tells the PHP engine to start and improve the code between the two. This parsing allows PHP to be embedded in a variety of different documents, and any outside of the start and end tags will be ignored by the PHP parser.
XML style
<?phpheader ("Content-type:text/html;charset=utf-8"); echo "Hi PHP, I can conquer you!";? >
If no other content exists after the PHP code, then the end tag can be omitted and the omission is advocated.
<?phpheader ("Content-type:text/html;charset=utf-8"); echo "Hi PHP, I can conquer you!"; /script ends with no PHP end tag
Short style
<?header ("Content-type:text/html;charset=utf-8"); echo "I am short style";
Only the Short_open_tag configuration command in the PHP configuration file is activated to use the short style
ASP style
<%header ("Content-type:text/html;charset=utf-8"); echo "I am ASP Style";%>
Only the Asp_tags configuration command in the PHP configuration file is activated to use ASP style
Scripting style
<script language= "PHP" >header ("Content-type:text/html;charset=utf-8"); echo "I am Script style"; </script >
Comments
PHP supports C, C + +, and Unix shell style (Perl style) annotations.
The comment types for PHP are:
-Single line Comment
That only one line of code can be commented at a time
-Multi-line Comment
That is, you can annotate multiple lines of code at a time
Single-line Comment
C + + style annotations
Comment Content
Shell style annotations
#注释内容
Multi-line comments
<?php/*............*/
Note: When using multi-line annotations, you cannot let annotations fall into a recursive loop
This article is from the "rime" blog, please be sure to keep this source http://kinrey.blog.51cto.com/10492082/1834628
PHP syntax structure