本文整理汇总了PHP中Token::generatePassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::generatePassword方法的具体用法?PHP Token::generatePassword怎么用?PHP Token::generatePassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::generatePassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSalt
public function getSalt()
{
$password = $this->password;
$token = new Token();
$hash = $token->generatePassword(15);
$this->hash = $hash;
$salt = md5($password . $hash);
return $salt;
}
示例2: getCookie
public function getCookie(Slim\Slim &$app)
{
if (empty($app->getCookie('username'))) {
//setting cokkie if the user doesn't have it
$generateToken = new Token();
$cookieKey = md5($generateToken->generatePassword(8));
$app->setCookie('username', $cookieKey, time() + 86400 * 4);
}
$cookie = $app->getCookie('username');
return $cookie;
}
示例3: postFile
public function postFile(Token &$generateToken, $postarr = array(), $postFile = array())
{
$postarr[] = $_POST;
$postFile[] = $_FILES;
$_FILES['img']['tmp_name'];
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["img"]["name"]);
$filename = trim($_FILES['img']['name']);
move_uploaded_file($_FILES["img"]["tmp_name"], $target_file);
$filesize = filesize('uploads/' . $filename);
//$generateToken = new Token();
//setting unique token
$token = $generateToken->generatePassword(8);
if (isset($_POST['public'])) {
$public = "1";
} else {
$public = "0";
}
$terminate = date('Y-m-d H:i:s', time() + 3600 * 24);
$array = array('filename' => $filename, 'filesize' => $filesize, 'token' => $token, 'public' => $public, 'terminate' => $terminate);
return $array;
}