Home  >  Article  >  Backend Development  >  UFT8截取字符串解决办法

UFT8截取字符串解决办法

WBOY
WBOYOriginal
2016-06-13 11:56:461162browse

UFT8截取字符串
比如下面的简介,客户要求所填的简介要显示满,但是简介里面有数字和标点符号,截取的最大值本身就不固定,它又要显示满。


------解决方案--------------------
不需要截取,用css可以轻松搞定
------解决方案--------------------
最大值为什么不固定?
------解决方案--------------------
css限定长度,超出隐藏
------解决方案--------------------
隐藏吧
a{display:inline-block;width:50px;height:50px;overflow:hidden;}
------解决方案--------------------

引用:
Quote: 引用:

最大值为什么不固定?
它数字站1个字符,汉字3个字符,我又不知道它里面是否有多少个数字。

mb_substr() 可以处理多字节截取。
Statement:
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