PHP - Add link to a URL in a string

后端 未结 3 1196
花落未央
花落未央 2020-11-30 12:49

I have a function that will add the tag before a link and after the link. However, it breaks for some webpages. How would

3条回答
  •  暖寄归人
    2020-11-30 13:34

    function processString($s) {
        return preg_replace('/https?:\/\/[\w\-\.!~#?&=+\*\'"(),\/]+/','$0',$s);
    }
    

提交回复
热议问题