Home  >  Article  >  Backend Development  >  Several tag parsing of PHP scripts_PHP tutorial

Several tag parsing of PHP scripts_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:30:581180browse

What we want to introduce to you today is about 1. PHP scripts have four types of tags: short tags and asp tags are convenient but have poor portability and distribution, and are generally not recommended. Also note that if you embed PHP in XML or XHTML you will need to use the standards tag < ?php ?> to maintain standards compliance.

A, standard tag: < ?php .. ?>

B, script tag: < script language=”php”>…< /script>

C, short tag: < ? … ?> You need to set short _open_tag=on in php.ini, the default is on, or add the –enable-short-tags option when compiling PHP. (PHP 3 version can also activate the use of short tags through the short_tags() function.)

D, asp tag (supported after PHP 3.0.4 version): <% … %> needs to be in php.ini Set asp_tags=on, the default is off

2, PHP script command delimiter: Like C, Java or Perl, PHP needs to exclude the last line of each statement (because the end tag implicitly represents a semicolon ) end the command with a semicolon. Omitting the semicolon at the end of the file facilitates the use of output buffering and include() or require()

3. PHP script comments: PHP supports C, C++ and Unix Shell style (Perl style) comments. For example:

Single-line comment: //, #
Multi-line comment: /* */

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><</span><span> ?php  </span></span></li><li><span>echo "This is a test"; // 单行注释 (c++ 风格),  </span></li><li class="alt"><span>/* 多行注释:单行注释说明1:"// </span><span class="tag">?></span><span>"中 </span><span class="tag">?></span><span>有效,  </span></span></li>
<li>
<span>单行注释说明2:"// </span><span class="tag"><</span><span> /script</span><span class="tag">></span><span>"中 </span><span class="tag"><</span><span> /script</span><span class="tag">></span><span>无效 */  </span>
</li>
<li class="alt"><span>echo "This is yet another test";  </span></li>
<li><span>echo "One Final Test"; # 单行注释 (shell风格)  </span></li>
<li class="alt">
<span class="tag">?></span><span>  </span>
</li>
</ol>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446259.htmlTechArticleWhat we want to introduce to you today is about 1. There are four tags in PHP scripts: short tags and asp tags. Convenient but poor in portability and distribution, it is generally not recommended. Also note that if you use PHP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn