我是 cron 工作的新手,我对这个主题做了很多搜索,但我无法完全理解它.cron 作业可以访问 cookie 或会话变量吗?
i am new to cron jobs and i have done much searching on this topic but i couldn't understand it fully. can cron jobs access cookies or session variables?
谢谢!
cron 作业将无法访问 cookie,因为根据定义,它不是从 Web 浏览器请求中调用的.只有 Web 浏览器会存储包含会话 ID 的 cookie.没有网络浏览器,没有 cookie,没有会话.
A cron job won't be able to access cookies, since by definition it is not being invoked from a web browser request. Only the web browser stores a cookie, which contains the session id. No web browser, no cookie, no session.
话虽如此,如果您确实知道会话 ID,您应该能够通过将 ID 输入 session_id()
在使用 session_start()
之前.
Having said that, if you do know the session id somehow, you should be able to start the session manually by feeding the id into session_id()
before using session_start()
.
这篇关于php cron 作业可以访问会话变量/cookies 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!