本文整理匯總了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;
}