PHP注釋掉代碼有幾種寫法

admin PHP編程評論1,145字數(shù) 712閱讀模式

HP 支持 C,C++ 和 Unix Shell 風格(Perl 風格)的注釋。例如:

  1. <?php  
  2.      echo  "This is a test" ;  // This is a one-line c++ style comment  
  3.      echo  "This is yet another test" ;  
  4.     echo  'One Final Test' ;  # This is a one-line shell-style comment  
  5. ?>  

單行注釋僅僅注釋到行末或者當前的 PHP 代碼塊,視乎哪個首先出現(xiàn)。這意味著在 // … ?> 或者 # … ?> 之后的 HTML 代碼將被顯示出來:?> 跳出了 PHP 模式并返回了 HTML 模式,// 或 # 并不能影響到這一點。如果啟用了 asp_tags 配置選項,其行為和 // %> 或 # %> 相同。不過, 標記在單行注釋中不會跳出 PHP 模式。文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

  1. <h1>This is an <?php  # echo 'simple'; ?> example</h1>  
  2. <p>The header above will say 'This is an  example'.</p>  

C 風格的注釋在碰到第一個 */ 時結(jié)束。要確保不要嵌套 C 風格的注釋。試圖注釋掉一大塊代碼時很容易出現(xiàn)該錯誤。文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

  1. <?php  
  2.   */  
  3. ?>  

PHP注釋有兩種:
用雙斜杠 // 這種是注釋掉一行代碼比如文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

  1. //$message = 'abc';  

用 /* 和 */ 這種是注釋掉一大段的,比如文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

  1. /* 
  2. $today = 'tomorrow'; 
  3. */  

以上就是PHP注釋掉代碼有幾種寫法.文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

更多相關(guān)文章

帝國CMS搜索頁面模板不支持靈動標簽和萬能標簽的方法文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html 文章源自網(wǎng)吧系統(tǒng)維護-http://www.strong-digital.cn/7667.html

版權(quán)聲明:文章圖片資源來源于網(wǎng)絡(luò),如有侵權(quán),請留言刪除!!!
廣告也精彩
admin
  • 本文由 發(fā)表于 2021年9月25日 17:13:21
  • 轉(zhuǎn)載請務(wù)必保留本文鏈接:http://www.strong-digital.cn/7667.html
匿名

發(fā)表評論

匿名網(wǎng)友 填寫信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: