简体   繁体   English

在PHP中进行特定的重定向后,强制重新加载页面

[英]Force reload of a page after a specific redirection in PHP

I have a website on WordPress, this website use Ajax Page load. 我在WordPress上有一个网站,该网站使用Ajax页面加载。 I have a login form (with theme my login) for my visitors and some are in trouble when login using Firefox. 我有一个用于访客的登录表单(主题为我的登录名),使用Firefox登录时有些麻烦。 They need to refresh manually their page after login to see the features reserved for subscribers. 他们需要在登录后手动刷新页面以查看为订阅者保留的功能。

I use that code in my functions.php to redirect my visitors after login on home : 我在home.login登录后在我的functions.php中使用该代码重定向访客:

add_filter("login_redirect", "gkp_subscriber_login_redirect", 10, 3);
function gkp_subscriber_login_redirect($redirect_to, $request, $user) {

  if(is_array($user->roles))
      if(in_array('administrator', $user->roles)) return site_url('/wp-admin/');

  return home_url();
}

I would like that the redirection to homepage also force a refresh of the page after the connexion. 我希望重定向到主页也可以在连接后强制刷新页面。 Is it possible ? 可能吗 ?

Thanks by advance. 预先感谢。

Like this: 像这样:

header("Refresh:0");

It refreshes your current page, and if you want to redirect it to another page, use following: 它会刷新您的当前页面,如果您要将其重定向到另一个页面,请使用以下命令:

header("Refresh:0; url=something.php");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM