本文整理匯總了PHP中uri::set_path方法的典型用法代碼示例。如果您正苦於以下問題:PHP uri::set_path方法的具體用法?PHP uri::set_path怎麽用?PHP uri::set_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類uri
的用法示例。
在下文中一共展示了uri::set_path方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: uri
function & _fetch(&$counter, $params)
{
$result =& parent :: _fetch($counter, $params);
$uri = new uri($_SERVER['PHP_SELF']);
//we're trimming trailing slashes: thus /root/about == /root/about/
$uri->set_path(rtrim($uri->get_path(), '/'));
foreach($result as $key => $data)
{
$nav_uri = new uri($data['url']);
$nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));
if ($uri->get_host() != $nav_uri->get_host())
continue;
if(is_integer($res = $uri->compare_path($nav_uri)))
{
if($res >= 0)
$result[$key]['in_path'] = true;
if($res == 0)
$result[$key]['selected'] = true;
}
}
return $result;
}
示例2: uri
function _compare_with_url($url)
{
$uri = new uri($_SERVER['PHP_SELF']);
//we're trimming trailing slashes: thus /root/about == /root/about/
$uri->set_path(rtrim($uri->get_path(), '/'));
$nav_uri = new uri($url);
$nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));
if ($uri->get_host() != $nav_uri->get_host()) {
return false;
}
return $uri->compare_path($nav_uri);
}