系统自带的函数mb_substr可以截取多字节的字符
strip_tags ― 从字符串中去除 HTML 和 PHP 标记
通过这两个函数便可解决
示例:
$str="我爱php";
echo mb_substr(strip_tags($str),0,3,'utf-8');
输出:我爱p
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