Skip to content

Instantly share code, notes, and snippets.

@ctrl-freak
Created July 12, 2011 01:38
Show Gist options
  • Save ctrl-freak/1077223 to your computer and use it in GitHub Desktop.
Save ctrl-freak/1077223 to your computer and use it in GitHub Desktop.
PHP $url_parts
<?
$url=str_replace('.html','',$_GET['u']);
$page_url=$url;
$args=array();
if(strstr($url,'?'))
{
$url=explode('?',$url);
$tmp=$url[1];
$tmp=explode('&',$tmp);
foreach($tmp as $t)
{
list($name,$value)=explode('=',$t);
$args[$name]=$value;
}
$url=$url[0];
}
$url=ereg_replace('^/|/$','',$url);
$url=str_replace('-','_',$url);
$page['url']=$url;
$url_parts=explode('/',$url);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment