Re: Parsing URLs
| From: | Yeti | Date: | Tue, 28 Oct 2008 08:22:10 +0000 |
| Subject: | Re: Parsing URLs | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282530@lists.php.net to get a copy of this message | ||
One could also abuse basename and pathinfo.
Works in PHP4+
<?php
$uri = 'http://www.domain.com/page/file/';
$pathinfo = pathinfo($uri);
$webpageaccess = array();
$webpageaccess[1] = $webpageaccess[2] = '';
if (isset($pathinfo['basename'])) $webpageaccess[1] = $pathinfo['basename'];
if (isset($pathinfo['dirname'])) $webpageaccess[2] =
basename($pathinfo['dirname']);
//var_dump($webpageaccess);
?>