php截取中文方法函数
来源:原创
时间:2017-09-08
作者:脚本小站
分类:PHP
$str = '搜索加勒比海盗';
header('content-type:text/html;charset=utf-8');
mb_internal_encoding('UTF-8');//设置内部编码
$condition = mb_substr($str, 0, 2);
echo $condition;
$str = '搜索加勒比海盗';
header('content-type:text/html;charset=utf-8');
mb_internal_encoding('UTF-8');//设置内部编码
$condition = mb_substr($str, 0, 2);
echo $condition;