您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php字符串截取小例子 php函数截取固定长度字符串

2025/12/13 22:33:34发布23次查看
=strlen($str)||!$len)return$str; $len-=3; $tempstr1=substr($str,0,$len); //截取字符串 $tempstr2=preg_replace('/([\x81-\xff]+)$/ms','',$tempstr1,1); //去掉结尾的连续汉字字符 if(!is_int((strlen($tempstr1)-strlen($tempstr2))/2)){ //去掉的字符为奇数? $tempstr1=substr($str,0,$len-1); }return$tempstr1.…;}?>
复制代码
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product