在Common目录中建立 function.php

<?php
function subtext($text, $length)
{
    if(mb_strlen($text, 'utf8') > $length) 
    return mb_substr($text, 0, $length, 'utf8').'...';
    return $text;
}

{$vo.goods_name|subtext=10}

调用方法传参数

 

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-01-11
  • 2022-02-03
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
相关资源
相似解决方案