问题描述
我是 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 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)