本文整理汇总了PHP中Grav\Common\Filesystem\Folder::shift方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::shift方法的具体用法?PHP Folder::shift怎么用?PHP Folder::shift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grav\Common\Filesystem\Folder
的用法示例。
在下文中一共展示了Folder::shift方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
/**
* Multisite setup for sub-directories or path based
* URLs for subsites.
*
* DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!
*/
use Grav\Common\Filesystem\Folder;
// Get relative path from Grav root.
$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : Folder::getRelativePath($_SERVER['REQUEST_URI'], ROOT_DIR);
// Extract name of subsite from path
$name = Folder::shift($path);
$folder = "sites/{$name}";
$prefix = "/{$name}";
if (!$name || !is_dir(ROOT_DIR . "user/{$folder}")) {
return [];
}
// Prefix all pages with the name of the subsite
$container['pages']->base($prefix);
return ['environment' => $name, 'streams' => ['schemes' => ['user' => ['type' => 'ReadOnlyStream', 'prefixes' => ['' => ["user/{$folder}"]]]]]];