主机百科
测评与优惠

dedecms中cn_substr函数的作用和使用方法

cn_substr


(DedeCms V57,V56,V55,V53)

cn_substr – 对中文字符串进行截取(单字节截取模式)

说明:

1
  string cn_substr(string $str, int $slen[, int $startdd])

参数:

$str  需要截取的字符串

$slen  截取的长度

$startdd  开始标记处,默认为0,也就是从头开始截取

返回:

返回截取后的字符串,错误返回空字符串

位置:

include/helpers/string.helpers.php

示例:

1.直接调用

1
  {field:description function='cn_substr(@me, 200)'/} 

2.标签嵌套

1
  {dede:arclist&nbsp; flag=&#39;h' typeid=''}  <a href='[field:arcurl/]'>[field:title function='cn_substr(@me,30)'/]</a>  {/dede:arclist}

赞(0)
未经允许不得转载:主机阁 » dedecms中cn_substr函数的作用和使用方法

登录

找回密码

注册