亚洲国产日韩欧美在线a乱码,国产精品路线1路线2路线,亚洲视频一区,精品国产自,www狠狠,国产情侣激情在线视频免费看,亚洲成年网站在线观看

PHP框架之Smarty中的注釋和截斷功能介紹

時間:2025-11-06 20:28:40 php語言

PHP框架之Smarty中的注釋和截斷功能介紹

  這篇文章主要介紹了Smarty中的注釋和截斷功能介紹,這兩個功能都是Smarty中不太常用的功能,但非常實用,需要的朋友可以參考下。更多消息請關注應屆畢業(yè)生網(wǎng)。

  注釋

  代碼如下:

  {* 這是一個單行Smarty注釋 來自于jb51.net,網(wǎng)頁源代碼里看不見*}

  {* 這是一個多行

  Smarty注釋

  并不發(fā)送到瀏覽器

  *}

  模板注釋由星號包圍,繼而由分隔符包圍,型如:{* 這是一個注釋 *}。Smarty注釋不會在最終模板的輸出中顯示,這點和不同。前者對于在模板中插入內(nèi)部注釋有用,因為沒有人能看到。;-)

  截斷truncate

  代碼如下:

  $smarty->assign('hxtitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');

  模板為:

  代碼如下:

  {$hxtitle}

  {$hxtitle|truncate}

  {$hxtitle|truncate:30}

  {$hxtitle|truncate:30:""}

  {$hxtitle|truncate:30:"---"}

  {$hxtitle|truncate:30:"":true}

  {$hxtitle|truncate:30:"...":true}

  {$hxtitle|truncate:30:'..':true:true}

  輸出為:

  代碼如下:

  Two Sisters Reunite after Eighteen Years at Checkout Counter.

  Two Sisters Reunite after Eighteen Years at Checkout Counter.

  Two Sisters Reunite after...

  Two Sisters Reunite after

  Two Sisters Reunite after---

  Two Sisters Reunite after Eigh

  Two Sisters Reunite after E...

  Two Sisters Re..ckout Counter.

【PHP框架之Smarty中的注釋和截斷功能介紹】相關文章:

PHP中--autoload和Smarty沖突的解決方法01-10

PHP中Yii框架之表單驗證規(guī)則11-02

php-smarty模版引擎中的緩存應用09-25

PHP及其功能介紹12-18

利用PHP模板引擎smarty12-22

php中的socket框架性能分析11-02

php中的注釋包括哪些03-07

PHP框架的概念09-24

PHP中使用smarty生成靜態(tài)文件的實例09-16