本文整理汇总了PHP中StringHelper::base64_url_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::base64_url_encode方法的具体用法?PHP StringHelper::base64_url_encode怎么用?PHP StringHelper::base64_url_encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringHelper
的用法示例。
在下文中一共展示了StringHelper::base64_url_encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_activation_email
public function send_activation_email()
{
$tags_mail = [':/name', ':/link'];
//modify link with constant !!! Not final version!
$link = 'http://tinyshopv2/account_activations/' . $user->activation_digest . '/edit/' . StringHelper::base64_url_encode($user->email);
$replace_mail = [$this->name, $link];
//modify path for file with constant !!! Not final version!
$mail_html = str_replace($tags_mail, $replace_mail, file_get_contents('../app/views/mailer/activation_mail.php'));
Mailer::send_mail($this->email, $this->name, 'Activation email', $mail_html);
}
示例2: function
if (!empty($messages_all)) {
$app->flash('messages', ['danger' => $messages_all]);
$app->redirect('/password_resets/new');
}
$user = User::where('email', '=', $params['email'])->first();
if (!$user) {
$app->flash('messages', ['danger' => ['Email address not found']]);
$app->redirect('/');
}
SessionsHelper::is_activated($app, $user);
if ($environment == 'development') {
// used on local machine when you not able to send email
// after submit password reset link appears in debug_info block
$user->create_digest('reset');
$user->save();
$app->flash('debug_info', ['link' => ['Password reset link' => '/password_resets/' . $user->reset_digest . '/edit/' . StringHelper::base64_url_encode($user->email)]]);
$app->redirect('/');
}
$user->create_digest('reset');
$user->save();
$user->send_reset_email();
$app->flash('messages', ['info' => ['Email send with password reset instructions']]);
$app->redirect('/');
});
//password_resets#edit
$app->get("/password_resets/:reset_digest/edit/:email", SessionsHelper::not_logged_in_user($app), function ($reset_digest, $email) use($app) {
$user = User::where('email', '=', StringHelper::base64_url_decode($email))->first();
PasswordResetsHelper::valid_user($app, $user, $reset_digest);
PasswordResetsHelper::check_expiration($app, $user);
SessionsHelper::is_activated($app, $user);
$app->render('password_resets/edit.php', ['reset_digest' => $reset_digest, 'email' => $email]);
示例3: array_merge
$messages_validation = $validation->messages()->all();
$messages_all = array_merge($message_password_confirmation, $messages_validation);
//if there is any errors
if (!empty($messages_all)) {
$app->flash('messages', ['danger' => $messages_all]);
$app->flash('prev_params', $params);
$app->redirect('/users/new');
}
$user = new User($params);
if ($environment == 'development') {
// used on local machine when you not able to send email
// after sign up activation link appears in debug_info block
$user->create_digest('activation');
$user->create_digest('password', $params['password']);
$user->save();
$app->flash('debug_info', ['link' => ['Activation link' => '/account_activations/' . $user->activation_digest . '/edit/' . StringHelper::base64_url_encode($user->email)]]);
$app->redirect('/');
}
$user->create_digest('activation');
$user->create_digest('password', $params['password']);
$user->send_activation_email();
$user->save();
$app->flash('messages', ['info' => ['Please check your email to activate your account.']]);
$app->redirect('/');
});
$app->get("/users/test", function () use($app, $validator, $environment) {
// $messages_all = ['Password confirmation doesn\'t match',
// 'second'
// ];
// $app->flash('messages', ['danger' => $messages_all]);
// $app->redirect('/users/new');