method parseUrl documentation in bbn\Str
Returns an array containing any of the various components of the URL that are present.
Example
X::hdump(\bbn\Str::parseUrl('http://localhost/phpmyadmin/?db=test&table=users&server=1&target=&token=e45a102c5672b2b4fe84ae75d9148981');
/* (array)
[
'scheme' => 'http',
'host' => 'localhost',
'path' => '/phpmyadmin/',
'query' => 'db=test&table=users&server=1&target=&token=e45a102c5672b2b4fe84ae75d9148981',
'url' => 'http://localhost/phpmyadmin/',
'params' => [
'db' => 'test',
'table' => 'users',
'server' => '1',
'target' => '',
'token' => 'e45a102c5672b2b4fe84ae75d9148981',
],
]
function($url)
{
$url = self::cast($url);
$r = X::mergeArrays(parse_url($url), ['url' => $url,'query' => '','params' => []]);
if (strpos($url,'?') > 0) {
$p = explode('?',$url);
$r['url'] = $p[0];
$r['query'] = $p[1];
$ps = explode('&',$r['query']);
foreach ($ps as $p){
$px = explode('=',$p);
$r['params'][$px[0]] = $px[1];
}
}
return $r;
}
Returns an array containing any of the various components of the URL that are present. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions