Maison >développement back-end >tutoriel php >php代码的几种风格
在HTML中嵌入php代码的几种风格
<code><span><span>html</span>></span><span>head</span>><span>meta</span><span>charset</span>=<span>"utf-8"</span>><span>title</span>> New Document <span><span>title</span>></span><span><span>head</span>></span><span>body</span>><span><span><?php </span><span>echo</span><span>'标准写法,类似xml写法'</span>.<span>'<br>'</span>; <span>echo</span><span>'我后面的分号可以省略的,但是不推荐<br>'</span><span>?></span></span><span>script</span><span>language</span>=<span>"php"</span>></span><span> echo<span>'这是脚本风格的标记'</span>.<span>'<br>'</span>; </span><span><span>script</span>></span><span><span></span><span>//需要在php.ini 设置short _open_tag=on</span><span>echo</span><span>"短标签的写法"</span>.<span>'<br>'</span>; <span>?></span></span><span>on</span> echo <span>"这是asp风格"</span>.<span>'<br>';</span> %><span><span>body</span>></span><span><span>html</span>></span><span><span><?php </span><span>echo</span><span>'当php后面没有非php代码,最后的结束标记可以省略!!'</span>; <span>#shell风格注释</span><span>//单行注释</span><span>/* *我是多行注释 */</span></span></span></code>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了php代码的几种风格,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。