php字符串截取函数(支持中文 utf-8截取)
代码如下 | 复制代码 |
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>environment</title> </head> <?php $str = "中12hb千钧一发lap"; echo mb_substr($str,0,5,'utf-8');echo '<br>'; echo mb_substr($str,5,3,'utf-8');echo '<br>'; echo mb_substr($str,8,4,'utf-8'); ?> <body> </body> </html> |
<?
代码如下 | 复制代码 |
function str_wrap1($str,$elen=30) echo str_wrap1($str,5); |
?>
教程网址:http://www.phprm.com/function/35005.html
欢迎收藏∩_∩但请保留本文链接。