‘壹’ php中 < >和<php >有区别吗如果有分别是什么功能
一个是短标签的形式,就是<? ?>,省略了php,功能是一样的,不过在使用<? ?>前需要调试说明。
‘贰’ PHP中 <= > 这个标签是干嘛用的怎么用
echo() 的快捷用法,但是你必须在php.ini 里面打开short_open_tag。
<?='aa';?>等同于<?php echo 'aa';?>。
如果short_open_tag打开了,<?php ?>就可以缩写成<? ?>。如果同时要用到XML,可以禁用此选项以便于嵌入使用 <?xml ?>,也可以通过PHP来输出。如:<?='<?xml version="1.0"';?>(例子来源: http://php.net/manual/zh/ini.core.php)
‘叁’ php短标签 作用
<?在php.ini里面
short_open_tag = Off
也被称为短标签
提倡的都是<?php ?>, 禁用<? ?>,因为短标签会破坏原生xml模板
官方给的解释是
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
意思就是这玩意打开了可以用,但是不建议使用
<?php
echo"";
?>
这才是规范的写法
用<?php ?>你永远不会出问题;而用<? ?>会可能出问题
例如:配置文件没有开启短标识
例如:<?xml version="1.0" ?>会被当作php
‘肆’ php中的<= >和<php >有什么区别么
<? ?>是短标签
<?php ?>是长标签
在php的配置文件(php.ini)中有一个short_open_tag的值,开启以后可以使用PHP的短标签:<? ?>
同时,只有开启这个才可以使用 <?= 以代替 <? echo 。在CodeIgniter的视频教程中就是用的这种方式。
但是这个短标签是不推荐的,使用<?php ?>才是规范的方法。只是因为这种短标签使用的时间比较长,这种特性才被保存了下来。
‘伍’ php怎样开启短标签short
在wamp/www目录下编写一个phpinfo.php文件,输出phpinfo(),如图:
找到Loaded Configuration File 的位置,我的在“D:wampinapache2.2.8inphp.ini”,按照此路径找到配置文件php.ini,打开,然后“Ctrl+F”查找“short”,就可以找到“short_open_tag=Off”,将其改成“short_open_tag=On”即可。然后重启wamp,短标签就起作用了。
‘陆’ php短标签效果,除了少写php外,还有其他作用么
没有。就是这么个效果。
‘柒’ php语言中<p>是什么意思 <>什么作用啊
php里可以和html混编。 <p>是html的段落标签。具体使用请看w3c关于<p>标签的详细讲解。
http://www.w3school.com.cn/tags/tag_p.asp