Recently, an excel file downloading function was developed. to solve the problem of width of each column, you can only manually adjust the branch. Therefore, a new line feed method is provided. [phpfunctionmbstringtoarray ($ str, $ cut_len, $ charset, $ inter & quot; & lt; br/& gt; & quot;) {$ strlenmb_strlen ($ str, $ chars
Recently, an excel file downloading function was developed. to solve the problem of each column width, you can only manually adjust the branch. Therefore, an automatic line feed method was provided.
[Php
Function mbstringtoarray ($ str, $ cut_len, $ charset, $ inter ="
"){
$ Strlen = mb_strlen ($ str, $ charset );
$ Array = array ();
While ($ strlen ){
$ Array [] = mb_substr ($ str, 0, $ cut_len, $ charset );
$ Str = mb_substr ($ str, $ cut_len, $ strlen-$ cut_len, $ charset );
$ Strlen = mb_strlen ($ str, $ charset );
}
Return implode ($ inter, $ array );
}
It's not bad to use. haha, this solves the problem of Chinese character garbled characters.