note 77053 deleted from function.parse-url by cmb
| From: | cmb@php.net | Date: | Sun, 19 Jan 2020 08:19:23 +0000 |
| Subject: | note 77053 deleted from function.parse-url by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213896@lists.php.net to get a copy of this message | ||
Note Submitter: stevenlewis at hotmail dot com
----
an update to the glue url function.
you are able to put a host and a path without a slash at the beginning of the path
<?php
function glue_url($parsed)
{
if (! is_array($parsed)) return false;
$uri = isset($parsed['scheme']) ?
$parsed['scheme'].':'.((strtolower($parsed['scheme']) ==
'mailto') ? '':'//'): '';
$uri .= isset($parsed['user']) ? $parsed['user'].($parsed['pass']?
':'.$parsed['pass']:'').'@':'';
$uri .= isset($parsed['host']) ? $parsed['host'] : '';
$uri .= isset($parsed['port']) ? ':'.$parsed['port'] : '';
if(isset($parsed['path']))
{
$uri .= (substr($parsed['path'],0,1) ==
'/')?$parsed['path']:'/'.$parsed['path'];
}
$uri .= isset($parsed['query']) ? '?'.$parsed['query'] :
'';
$uri .= isset($parsed['fragment']) ? '#'.$parsed['fragment'] :
'';
return $uri;
}
?>