本文整理汇总了PHP中path::addTrailingSlash方法的典型用法代码示例。如果您正苦于以下问题:PHP path::addTrailingSlash方法的具体用法?PHP path::addTrailingSlash怎么用?PHP path::addTrailingSlash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::addTrailingSlash方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddTrailingSlash
public function testAddTrailingSlash()
{
$this->assertEquals('/', path::addTrailingSlash(''));
$this->assertEquals('a/', path::addTrailingSlash('a'));
$this->assertEquals('alphA/', path::addTrailingSlash('alphA'));
$this->assertEquals('alphA/', path::addTrailingSlash('alphA/'));
$this->assertEquals('alphA//', path::addTrailingSlash('alphA//'));
$this->assertEquals('/alphA/', path::addTrailingSlash('/alphA'));
$this->assertEquals('/alphA/', path::addTrailingSlash('/alphA/'));
$this->assertEquals('/alphA//', path::addTrailingSlash('/alphA//'));
$this->assertEquals('///alphA//', path::addTrailingSlash('///alphA//'));
}
示例2: current
/**
* Retrieves current singleton session manager.
*
* This method creates new session manager or restores one from available
* record in session space on demand.
*
* @return session
*/
public static final function current()
{
if (!self::$current instanceof self) {
self::getScopeParameter($domain, $path);
\session_set_cookie_params(0, path::addTrailingSlash($path), $domain);
// trigger import of class crypt so it may set required cookies
crypt::init();
// without existing link in current runtime check for snapshot
// stored in session
@session_start();
if ($_SESSION[self::stubName] instanceof self) {
// restore found snapshot
self::$current = $_SESSION[self::stubName];
} else {
// not in session -> start new session manager
self::$current = new static();
}
}
// (re-)retrieve current session manager instance
return self::$current;
}