开发者

replace any link

I have a news script in PHP i need the script to replace any link which it will be included within the news (links to other websites which the original news will be there ) i need the link for the website to b开发者_开发问答e replace with click here instead , all the links will be replaced every time with click here


$url="http://google.com";
$url=preg_replace('@(http?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">Click Here</a>', $url);
echo $url;//echoes <a href="http://google.com">Click Here</a>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜