当前位置: 首页>>代码示例>>PHP>>正文


PHP Path::rm_last方法代码示例

本文整理汇总了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;
}
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:56,代码来源:func.php

示例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'];
}
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:31,代码来源:var.php

示例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));
 }
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:5,代码来源:PathTest.php


注:本文中的Path::rm_last方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。