What is PHPSESSID?(PHPSESSID 是什么?)
问题描述
我在玩饼干.而且我没有任何名为 PHPSESSID 的 cookie.
I'm playing around with cookies. And I dont have any cookies called PHPSESSID.
我需要吗?我可以删除它吗?
Do i need it? Can i remove it?
它的功能"是什么?
if (count($_POST)) {
setcookie("TestCookie", htmlspecialchars($_POST['val']), time()+3600);
}
print_r($_COOKIE);
打印:
Array
(
[TestCookie] => blabla
[PHPSESSID] => el4ukv0kqbvoirg7nkp4dncpk3
)
推荐答案
PHP 使用两种方法之一来跟踪会话.如果启用了 cookie,就像您的情况一样,它就会使用它们.
PHP uses one of two methods to keep track of sessions. If cookies are enabled, like in your case, it uses them.
如果 cookie 被禁用,它会使用 URL.虽然这可以安全地完成,但它更难,而且通常不是.参见,例如,会话固定.
If cookies are disabled, it uses the URL. Although this can be done securely, it's harder and it often, well, isn't. See, e.g., session fixation.
搜索它,您会得到很多 SEO 建议.传统观点是您应该使用 cookie,但 php 会以任何一种方式跟踪会话.
Search for it, you will get lots of SEO advice. The conventional wisdom is that you should use the cookies, but php will keep track of the session either way.
这篇关于PHPSESSID 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHPSESSID 是什么?
基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
