开发者

PHP replacing URL to a href [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

PHP URL to Link with Regex

how to convert some urls in string to <a href="here url">here url</a>?

开发者_如何转开发

I'm thinking about preg_replace but what regex to use?

Thanx!


It's not advised to use regex with html code, as HTML is a context free language, and regular expressions are most advised to use with regular languages. Instead look into DOM libraries, as an easy way to find and replace attributes of html tags: http://php.net/manual/en/book.dom.php

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜