<分区>
基本上我想要实现的是这个,下面的内容不起作用,但你应该明白了。
if (session_status() == PHP_SESSION_ACTIVE) {
show specific icons
}
else
{
don't show specific icons
}
我做错了什么。如何可靠地检查 session 是否在 php 5.4 中启动。我在某处读到这是推荐的方式。
<分区>
基本上我想要实现的是这个,下面的内容不起作用,但你应该明白了。
if (session_status() == PHP_SESSION_ACTIVE) {
show specific icons
}
else
{
don't show specific icons
}
我做错了什么。如何可靠地检查 session 是否在 php 5.4 中启动。我在某处读到这是推荐的方式。
最佳答案
session_status可用于 PHP v5.4 及更高版本,也许这就是原因。
你可以试试session_id :
session_id() returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists).
正是 PHP 5.4 以下所需要的! ;)
关于php - 检查 PHP session 是否处于事件状态;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13978513/
相关文章:
php - 按顺序显示项目,包括图像 WooCommerce
php - 如何验证JQuery/AJAX Referer以防止CSRF?
ruby-on-rails - 在 Rails 控制台中访问 current_user
php - 使用 memcached 作为 CodeIgniter 的 session 存储
javascript - 如果带有 id 的 div 具有特定文本,则删除其他 div • Javascript
php - ffmpeg:在 php 中以原始方向生成视频的缩略图