Php parse links/emails

前端 未结 4 1105
时光取名叫无心
时光取名叫无心 2020-12-06 08:11

I am wondering if there is a simple snippet which converts links of any kind:

http://www.cnn.com to http://www.cnn.com&l         


        
4条回答
  •  星月不相逢
    2020-12-06 08:35

    Try this out. (for links not email)

    $newTweet = preg_replace('!http://([a-zA-Z0-9./-]+[a-zA-Z0-9/-])!i', '\\0', $tweet->text);
    

提交回复
热议问题