[Php 5> = 5.4.0, Php 7, Php 8]
session_status - Trả về trạng thái phiên hiện tại — Returns the current session status
Sự mô tả
session_status []: int[]: int
Thông số
Chức năng này không có tham số.
Trả về giá trị
-
PHP_SESSION_DISABLED
nếu các phiên bị vô hiệu hóa. if sessions are disabled. -
PHP_SESSION_NONE
nếu các phiên được bật, nhưng không có tồn tại. if sessions are enabled, but none exists. -
PHP_SESSION_ACTIVE
Nếu các phiên được bật và một phiên tồn tại. if sessions are enabled, and one exists.
coder dot ua tại gmail dot com ¶ ¶
8 năm trước
Universal function for checking session status.
Thông tin tại Eurocron dot de ¶ ¶
3 năm trước
Use always session_status[], to check if a session is already started and active.
if[session_status[] !== PHP_SESSION_ACTIVE] session_start[];
or
if[session_status[] === PHP_SESSION_NONE] session_start[];
Don't use
if[!isset[$_SESSION]] session_start[];
or
if[session_id[] === ""] session_start[];
They will not work properly after a call to session_write_close[].
Both functions will continue to report, that the session exists.
And this is right, you can read from $_SESSION, but if you want to write,
you need session_start[] again.
As a shorthand you can use
@session_start[]
with the @ at the beginning to suppress the
PHP notice "A session had already been started - ignoring session_start[]"
PHP_SESSION_NONE
0
Ben [Aocool tại MSN D0T com] ¶ ¶
6 năm trước
PHP_SESSION_NONE
2
PHP_SESSION_NONE
3
PHP tại PointPro Dot NL ¶ ¶
9 năm trước
PHP_SESSION_NONE
5
PHP_SESSION_NONE
6
PHP_SESSION_NONE
7
PHP_SESSION_NONE
8
PHP_SESSION_NONE
9
PHP_SESSION_ACTIVE
0
PHP_SESSION_ACTIVE
1
Ayon tại Hyurl Dot Com ¶ ¶
6 năm trước
PHP_SESSION_ACTIVE
3
PHP tại PointPro Dot NL ¶ ¶
8 năm trước
PHP_SESSION_ACTIVE
4
PHP_SESSION_ACTIVE
5
Thông tin tại Eurocron dot de ¶ ¶
3 năm trước
PHP_SESSION_ACTIVE
7
PHP_SESSION_ACTIVE
8
PHP_SESSION_ACTIVE
9
Ben [Aocool tại MSN D0T com] ¶ ¶
9 năm trước
Universal function for checking session status.
1
Universal function for checking session status.
2
Universal function for checking session status.
3
Universal function for checking session status.
4