Home >Backend Development >PHP Tutorial >php婚配utf-8完整字符,可以防止截取乱码
php匹配utf-8完整字符,可以防止截取乱码
function utf8( $a, $s = '' ){ preg_match_all( '/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/', $a, $d, PREG_PATTERN_ORDER ); return join( $s, $d[0] );}