Home > Backend Development > PHP Tutorial > 请问下thinkphp如何控制输出啊

请问下thinkphp如何控制输出啊

WBOY
Release: 2016-06-23 14:15:13
Original
929 people have browsed it

比如我有一个数组哈$names = array("111111111111111111111","222222222222222222222","333333333333333333333");



{$vo}



我要控制这个VO值的长度怎么来做啊,不是Lenth的值哈,就是我想控制只取5个字符出来的意思。
请老师赐教!


回复讨论(解决方案)

输出:{$vo|strval|substr=0,5}

就像二楼那样,在模板上调用函数输出

php有个截取字符串长度的函数,你直接在模板使用即可,或者自己写个截取字符串长度的函数,模板自调用也可。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template