/*
* 将混编的字符串按照规则截取并且不出现乱编
* $string :字符串
* $len:第一行长度
* $lenmore :其余行长度
* mb_strlen:获取字符串长度
* mb_strlen(‘中文abc123’) = 8; strlen(‘中文abc123’ ) = 12
* mb_substr :切割含有中文字符串 substr:用于切割英文字符串
*/
public function chunkstr($string,$len,$lenmore){
//初始化长度
$start = 0;
//带编码格式获取字符串长度
$strlen = mb_strlen($string);
//循环截取字符串
while ($strlen) {
if(empty($array)){
$array[] = mb_substr($string,$start,$len,"utf8");
$string = mb_substr($string, $len, $strlen,"utf8");
$strlen = mb_strlen($string);
}else{
$array[] = mb_substr($string,$start,$lenmore,"utf8");
$string = mb_substr($string, $lenmore, $strlen,"utf8");
$strlen = mb_strlen($string);
}
}
return $array;
}