PHP find all links in the text

后端 未结 8 1504
猫巷女王i
猫巷女王i 2021-02-15 23:36

I want to find all links in the text like this:

Test text http://hello.world Test text 
http://google.com/file.jpg Test text https://hell.o.wor.ld/test?qwe=qwe T         


        
8条回答
  •  情书的邮戳
    2021-02-16 00:16

    {$url[0]} ", $text);
    
    } else {
    
           // if no urls in the text just return the text
           echo $text;
    
    }
    ?>
    

    Reference:http://css-tricks.com/snippets/php/find-urls-in-text-make-links/

提交回复
热议问题