count_characters[字符计数]

count_characters(计算变量里的字符数)

test.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('test.html');

test.html:
{$articleTitle}
{$articleTitle|count_characters}
{$articleTitle|count_characters:true} //空格也计入数

输出:
Cold Wave Linked to Temperatures.
29
33

继续学习
||
<?php echo "count_characters(计算变量里的字符数)";
提交重置代码
  • 推荐课程
  • 评论
  • 问答
  • 笔记
  • 课件下载
课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~