Wordpress WP 会话管理器变量并不总是被设置 [英] Wordpress WP Session Manager variables not always being set

查看:48
本文介绍了Wordpress WP 会话管理器变量并不总是被设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对上面的插件(WP Session Manager)有一个问题,我设置的会话变量并不总是设置.我知道我用来设置变量的 PHP 是正确的,因为它们有时确实有效.但是例如,我可以让它们完美地工作并作为测试回显到屏幕上,然后我注销"并通过将它们设置为"来清空所有变量,然后重新登录(并再次设置它们)但这次它们没有被回显,这意味着它们不能被设置.

I have an issue with the above plugin (WP Session Manager) where the session variables I set, are not always set. I know the PHP I'm using to set the variables is correct as they do work sometimes. But for example, I can have them working perfectly fine and echo'ed out to the screen as a test, then I 'logout' and blank all the variables by setting them to "", then log back in (and set them again) but they do not get echo'ed out this time, meaning they must not be set.

我知道一个肯定有效,因为它用于查看用户是否登录,而且我只被要求登录我的网站一次,我可以浏览页面等,关闭浏览器然后我仅在我使用注销按钮清空变量时才要求重新登录.

I know one works for definite, as it is used to see if the user is logged in or not, and I only get asked to log in on my site once, I can navigate around pages etc, close the browser and I'm only asked to log back in when I use my logout button to blank the variables.

有谁知道这可能是什么原因造成的?或者这将是很难诊断的事情?

Does anyone know what might be causing this please? Or is it going to be something very hard to diagnose?

不知道有没有帮助(解决问题),关于编辑会话超时时间,我看到插件的FAQ页面上有信息,说可以编辑使用这个过滤器

Don't know if it will help or not (to fix the issue), with regards to editing the session timeout time, I see that there is the info on the FAQ page of the plugin, saying that it can be edited using this filter

add_filter( 'wp_session_expiration', function() { return 60 * 60; } ); // Set expiration to 1 hour

但是这个过滤器是在哪里找到/编辑或添加的?

But where is this filter found/edited or added?

希望有人能帮助解决这个问题:)

Hope someone can help with the problem :)

谢谢!

推荐答案

我现在已经解决了这个问题.立即重定向到其他页面会导致问题,在执行重定向之前等待 1 秒以允许设置变量.

I have fixed this now. Redirecting to a different page instantly was causing an issue, waiting for 1 second before doing the redirect allowed the variables to be set.

这篇关于Wordpress WP 会话管理器变量并不总是被设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆