本文整理匯總了PHP中Hash::hashUnique方法的典型用法代碼示例。如果您正苦於以下問題:PHP Hash::hashUnique方法的具體用法?PHP Hash::hashUnique怎麽用?PHP Hash::hashUnique使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Hash
的用法示例。
在下文中一共展示了Hash::hashUnique方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: forceLogin
public static function forceLogin($user = null, $remember = false)
{
if ($user->exists()) {
DB::instance()->delete("user_sessions", array("", "hash", "=", Cookie::get(Config::get('remember/cookie_name'))));
Session::put(Config::get('session/loggedId'), $user->id());
if ($remember) {
$hash = Hash::hashUnique();
DB::instance()->insert("user_sessions", array('user_id' => $user->id(), 'hash' => $hash, 'expiry' => DateFormat::sql(time() + Config::get('remember/cookie_expiry'))));
Cookie::put(Config::get('remember/cookie_name'), $hash, Config::get('remember/cookie_expiry'));
}
self::$_currentUser = new User();
}
}
示例2: Smarty
<?php
require_once 'app/core/init.php';
require_once 'main.php';
if (isset($_GET['page']) && !empty($_GET['page'])) {
$smarty = new Smarty();
$smarty->debugging = Config::get('debug/smartyDebug');
$smarty->caching = Config::get('smarty/caching');
$smarty->cache_lifetime = Config::get('smarty/cache_lifetime');
$cache_id = md5(json_encode($_GET) . json_encode($_POST) . Notifications::getAsJson());
$pageFile = 'app/pages/' . $_GET['page'] . '.php';
$templateFile = 'templates/pages/' . $_GET['page'] . '.tpl';
if (file_exists($pageFile) && file_exists($templateFile)) {
require $pageFile;
if (!$allowCaching) {
$cache_id = md5($cache_id . Hash::hashUnique());
}
if (!$smarty->isCached($templateFile, $cache_id)) {
$smarty = createPage($smarty);
$smarty = pageAddMain($smarty);
}
$smarty = pageAddMessages($smarty);
$smarty->loadFilter("output", "trimwhitespace");
$smarty->display($templateFile, $cache_id);
} else {
Redirect::error(404);
}
} else {
Redirect::to('?page=home');
}
示例3: generate
public static function generate()
{
return Session::put(Config::get('session/token_name'), md5(Hash::hashUnique()));
}