去掉一串字符串中的 中文的部分,以及详解截取字符串的方法

<?
$str='点击此处  https://kg2.qq.com/node/play?s=PPxVVBPi9m4AEPj7&shareuid=6a989981272e368f35&topsource=a0_pn201001006_z11_u854423141_l0_t1553749283__    快来分享吧!';
$result = preg_replace('/([\x80-\xff]*)/i','',$str);
echo $result;
?>

 

结果:
https://kg2.qq.com/node/play?s=PPxVVBPi9m4AEPj7&shareuid=6a989981272e368f35&topsource=a0_pn201001006_z11_u854423141_l0_t1553749283__

  

 

 

扩展:php内置函数 是专门截取字符串的:

explode() ;strstr();substr();

strpos()

 

posted @ 2019-03-28 15:51  微联云  阅读(1267)  评论(0编辑  收藏  举报