Home  >  Article  >  Backend Development  >  啊 除去一段话中的URL

啊 除去一段话中的URL

WBOY
WBOYOriginal
2016-06-13 13:04:56760browse

求助啊急 除去一段话中的URL
想用 这个函数 preg_replace 除去一段话 如:jackie.cai免费领了啊http://www.ndjj.com/product.php?product_no=842,产品真心不错啊!喜试网有N多免费试用产品,不要钱免运费,这么好的事还等什么?]~~

中的 链接
求助

------最佳解决方案--------------------
$s='jackie.cai免费领了啊http://www.ndjj.com/product.php?product_no=842,产品真心不错啊!喜试网有N多免费试用产品,不要钱免运费,这么好的事还等什么?]~~';
echo preg_replace('/https?:\/\/www\.[\w-.]+\/[\w.-?]+/is','',$s);
------其他解决方案--------------------
哦,少考虑一些情况,改改:
echo preg_replace('/https?:\/\/www\.[\w-.]+\/[\w.-?=\/]+/is','',$s);
------其他解决方案--------------------
感谢 非常嘿嘿

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn