Check whether session started using Predefined Constants
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
下列常量由此扩展定义,且仅在此扩展编译入 PHP 或在运行时动态载入时可用。
SID
(string)
PHP_SESSION_DISABLED
(int)
PHP_SESSION_NONE
(int)
PHP_SESSION_ACTIVE
(int)
Check whether session started using Predefined Constants
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
SID constant defined dynamically!
var_dump(defined('SID')); // bool(false) - Not defined...
session_start();
var_dump(defined('SID')); // bool(true) - Defined now!