本文整理汇总了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()));
}