技术渣 2016-11-07
<meta charset="UTF-8"> <?php //将一个字符串转换成数组,支持中文 function strToArray($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string, 0, 1, "utf8"); $string = mb_substr($string, 1, $strlen, "utf8"); $strlen = mb_strlen($string); } return $array; } $string = '链接:www.onestopweb.cn'; $arr = strToArray($string); print_r($arr); ?>
效果图: