本文整理汇总了PHP中Path::rm_last方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::rm_last方法的具体用法?PHP Path::rm_last怎么用?PHP Path::rm_last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::rm_last方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
/**
* Wandelt eine relative URL in eine absolute um und modifiziert den
* HTTP-Header(Location). Kehrt nicht zurück.
* @param $path Pfad zur aufzurufenden Webseite
* @param $arg GET-Argumente (?x=23&y=42)
* @param $ilink HTML-interner Link (#foo)
* @return never, Funktion terminiert die Ausführung und kehrt nicht zurück.
*/
function redirect($path = '', $arg = array(), $ilink = '')
{
$protocol = 'http://';
$host = $_SERVER['HTTP_HOST'];
$file = $_SERVER['PHP_SELF'];
$pos = strpos($path, '://');
if ($pos) {
$pos += 3;
$protocol = substr($path, 0, $pos);
$path = substr($path, $pos);
$pos = strpos($path, '/');
$host = substr($path, 0, $pos);
$path = substr($path, $pos);
}
if (!$path) {
$path = $file;
}
if (substr($path, 0, 1) != '/') {
$path = Path::rm_last($file) . $path;
}
$path = Path::clean($path);
if (strstr($path, '#')) {
list($path, $internal_link) = explode('#', $path);
if ($ilink == false) {
$ilink = $internal_link;
}
}
if (is_array($arg) && sizeof($arg) > 0) {
if (strstr($path, '?')) {
$z = '&';
} else {
$z = '?';
}
foreach ($arg as $n => $v) {
$path .= $z . $n . '=' . $v;
$z = '&';
}
}
$path = sessionurl($path);
if ($ilink && substr($_SERVER['HTTP_USER_AGENT'], 0, 5) != 'Opera') {
$path .= '#' . $ilink;
}
if (substr($path, 0, 7) != $protocol) {
$path = $protocol . $host . $path;
}
header('Location:' . $path);
exit;
}
示例2: cron
$output->nav['copyright'] = $root . 'COPYING';
// title and headline
$output->title[0] = 'infoschool';
$output->headline[0] = 'infoschool';
// navigation menu
$output->menu['./'] = 'start';
$output->menu['calendar/'] = 'calendar';
$output->menu['supply/'] = 'supply schedule';
$output->menu['forum/'] = 'Forum';
$output->menu['files/'] = 'file exchange';
$output->menu['messages/'] = 'Messages';
// $output->menu['zensuren/'] = 'grades';
$output->menu['news/'] = 'News';
// $output->menu['benutzer/'] = 'users';
$output->menu['users/'] = 'Users';
if (isset($_SESSION['admin']) && $_SESSION['admin']) {
$output->menu['statistics/'] = 'statistics';
}
$output->menu['dokumentation/'] = 'help';
$output->menu['dokumentation/faq.php'] = 'faq';
$output->menu['about/'] = 'About';
// subdir of the software
$webdir = Path::clean(Path::rm_last($_SERVER['SCRIPT_NAME']) . $root);
// system-root for the user: http://server.domain.tld/foo/
$http_root = 'http://' . $_SERVER['SERVER_NAME'] . $webdir;
// starts outstanding jobs
$cron = new cron();
// $output->out_of_service = true;
if (isset($_GET['oos'])) {
$output->out_of_service = $_GET['oos'];
}
示例3: test_rm_last_file_not_dir
function test_rm_last_file_not_dir()
{
$path = '/root/bla/func/';
$this->assertEquals('/root/bla/func/', Path::rm_last($path));
}