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 是什么?


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- PHP - if 语句中的倒序 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01