本文整理汇总了PHP中Path::linkto方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::linkto方法的具体用法?PHP Path::linkto怎么用?PHP Path::linkto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::linkto方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
function set($name = '', $input = '', $path = './')
{
$root = $GLOBALS['root'];
$this->subdir = Path::linkto($path, $root);
$tmpl_path = $root . 'tmpl/' . $this->subdir;
parent::set($name, '', $tmpl_path);
$this->set_lang();
$this->add_input($input);
}
示例2: format_menuitem
function format_menuitem($url, $caption, $level, $dir = false)
{
$url = Path::linkto($GLOBALS['root'] . $url);
$caption = output::mask($caption);
$m = array('menu_spacer' => array(), 'menu_entry' => array(), 'menu_dir' => array(), 'menu_url' => $url, 'menu_caption' => array(), 'menu_caption_this' => array());
for ($i = 0; $i < $level; $i++) {
$m['menu_spacer'][] = array();
}
if ($dir) {
$m['menu_dir'][] = array();
} else {
$m['menu_entry'][] = array();
}
$document_root = $_SERVER['DOCUMENT_ROOT'];
if (substr($document_root, -1) == '/') {
$document_root = substr($document_root, 0, -1);
}
$a = Path::absolute($url);
$b = sessionurl($a);
$c = $document_root . $_SERVER['REQUEST_URI'];
if ($a == $c || $b == $c) {
$m['menu_caption_this'][0]['menu_caption'] = $caption;
} else {
$m['menu_caption'][0]['menu_caption'] = $caption;
}
return $m;
}
示例3: test_linkto
function test_linkto()
{
$source = 'a/b/c/d.php';
$destination = 'a/b/e/d.php';
$this->assertEquals('../e/d.php', Path::linkto($destination, $source));
}