當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Folder::shift方法代碼示例

本文整理匯總了PHP中Gantry\Component\Filesystem\Folder::shift方法的典型用法代碼示例。如果您正苦於以下問題:PHP Folder::shift方法的具體用法?PHP Folder::shift怎麽用?PHP Folder::shift使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gantry\Component\Filesystem\Folder的用法示例。


在下文中一共展示了Folder::shift方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dirname

use Gantry\Component\Filesystem\Folder;
define('PRIME_ROOT', dirname($_SERVER['SCRIPT_FILENAME']));
define('PRIME_URI', dirname($_SERVER['SCRIPT_NAME']));
date_default_timezone_set('UTC');
// Bootstrap Gantry framework or fail gracefully (inside included file).
$gantry = (include_once PRIME_ROOT . '/includes/gantry.php');
// Get current theme and path.
$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : Folder::getRelativePath($_SERVER['REQUEST_URI'], PRIME_URI);
$path = explode('?', $path, 2);
$path = reset($path);
$extension = strrchr(basename($path), '.');
if ($extension) {
    $path = substr($path, 0, -strlen($extension));
}
$theme = strpos($path, 'admin') !== 0 ? Folder::shift($path) : null;
define('THEME', $theme);
define('PAGE_PATH', $path ?: ($theme ? 'home' : ''));
define('PAGE_EXTENSION', trim($extension, '.') ?: 'html');
// Bootstrap selected theme.
$include = PRIME_ROOT . "/themes/{$theme}/includes/gantry.php";
if (is_file($include)) {
    include $include;
}
// Enter to administration if we are in /ROOT/theme/admin. Also display installed themes if no theme has been selected.
if (!isset($gantry['theme']) || strpos($path, 'admin') === 0) {
    require_once PRIME_ROOT . '/admin/admin.php';
    exit;
}
// Boot the service.
/** @var Gantry\Framework\Theme $theme */
開發者ID:Tanver186,項目名稱:gantry5,代碼行數:30,代碼來源:index.php


注:本文中的Gantry\Component\Filesystem\Folder::shift方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。