Home > Article > Backend Development > How to parse all URL addresses in a string in php_PHP tutorial
The details are as follows:
4 11 12 |
<๐>
<๐>
<๐>// $html = the html on the page<๐>
<๐>// $current_url = the full url that the html came from<๐>
<๐>//(only needed for $repath)<๐>
<๐>// $repath = converts ../ and / and // urls to full valid urls<๐>
<๐>function pageLinks($html, $current_url = "", $repath = false){<๐>
<๐>preg_match_all("/ |