在 php cgi 环境中设置 cookie,而不使用 php api
如何在 php CGI 环境中使用 cookie,而不使用 PHP 中的任何 api 函数?
How can I use cookies in a php CGI Enviroment without using any api functions from PHP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,您想在 CGI 环境中使用 php 设置 cookie 吗?
复制代码并将其命名为whatever.cgi并使其可执行。
行尾的\n是必须的。 否则你会遇到麻烦:)
现在让我们设置一个 cookie:
将名称为 foo 的 Cookie 设置为值栏。 60 秒后过期。
现在您可以从 HTML 标头开始。
如果要删除 cookie,请将 max-age 设置为零
Ok you want to setup cookies with php in a CGI Enviroment?
Copy the code and name it to whatever.cgi and make it executable
The \n at the end of the line is a must. Or you will run into trouble :)
Now let's set a cookie:
Sets the Cookie with the Name foo to the Value bar. Expires in 60 seconds.
Now you can start with the HTML Header.
If you want to delete the cookie, set the max-age to zero