I'm in the process of rewriting a Perl-based web crawler I wrote nearly 8 years ago in PHP. I used the quite handy URI::URL module in perl to do things like:
$sourceUrl = '/blah.html';
$baseHost = 'http://www.example.com';
my $url = URI::URL->new($sourceUrl, $baseHost);
return $url->abs;
returns: ' http://www.example.com/blah.html '
the parse_url function in PHP is quite handy, but is there something more robust? Specifically something that will give the above functionality?
也许Zend_Uri是您的寻找?
print $baseHost . $sourceURL;
Am I missing something? Your way seems needlessly overcomplicated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.