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