導航:首頁 > 編程語言 > php短標簽的作用

php短標簽的作用

發布時間:2023-01-18 05:43:50

『壹』 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

閱讀全文

與php短標簽的作用相關的資料

熱點內容
滴滴號碼加密怎麼解除 瀏覽:844
模具編程的職責 瀏覽:941
華為ssh改加密演算法 瀏覽:147
文件夾空白合同 瀏覽:761
pythonwebpy開發 瀏覽:669
不是c編譯器的有 瀏覽:660
win10壓縮包下載 瀏覽:905
逆戰手機app怎麼樣 瀏覽:946
自嗨自我解壓圖片 瀏覽:395
電子書導入kindle哪個文件夾 瀏覽:418
pythontcpserver性能 瀏覽:544
linux文件夾改名 瀏覽:564
單片機開發板是什麼 瀏覽:851
阿里雲伺服器不能截屏 瀏覽:866
如何自己製作聯想伺服器 瀏覽:843
停車場規劃演算法 瀏覽:923
深蹲PDF 瀏覽:908
數據科學包python 瀏覽:849
程序員學習視頻網站 瀏覽:125
吃雞游戲如何安卓轉蘋果 瀏覽:188