[英]Slim framework 3 $_SESSION variables
is there any possibility to use PHP sessions in Slim v3?有没有可能在 Slim v3 中使用 PHP 会话? If not, what's a good replacement?
如果没有,什么是好的替代品? And if I can use them, where I should put session_start(), on index.php or in files I'm using $_SESSION variables?
如果我可以使用它们,我应该把 session_start() 放在 index.php 上还是放在我使用 $_SESSION 变量的文件中?
You can use $_SESSION
within a Slim application with ease.您可以轻松地在 Slim 应用程序中使用
$_SESSION
。 Put session_start()
at the top of index.php.将
session_start()
放在 index.php 的顶部。
Alternatively, there are a number of PSR-7 session middleware components out there such as:或者,有许多 PSR-7 会话中间件组件,例如:
由于 slim 是一个“PHP”微框架,因此任何 php 函数(核心 php)都可以毫无问题地执行。
try this试试这个
session_cache_limiter(false);
session_start();
$_SESSION["your_session_data"] = $your_session_data;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.