Home  >  Article  >  Backend Development  >  求一个网址截取的正则替换表达式

求一个网址截取的正则替换表达式

WBOY
WBOYOriginal
2016-06-23 13:46:011095browse

求一个网址截取的正则替换表达式

http://p.yiqifa.com/n?k=2mLErnws6E4H2mLErI6H2mLsWN3OrnDsWN2e6QLs1NDF6ZLErZyH2mLe6n6w3E3LMZqt6cuLUJeH&spm=1.1.1.1&t=http://www.xuansou.com/

这样一个网址,想把第二个http://前面的内容全部替换成空
也就是只想保留http://www.xuansou.com/

需要怎么弄,谢谢,我是菜鸟


回复讨论(解决方案)

$s = 'http://p.yiqifa.com/n?k=2mLErnws6E4H2mLErI6H2mLsWN3OrnDsWN2e6QLs1NDF6ZLErZyH2mLe6n6w3E3LMZqt6cuLUJeH&spm=1.1.1.1&t=http://www.xuansou.com/';echo preg_replace('/.+?t=/', '', $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