简体   繁体   中英

Does session_start() clear cookies data?

I built a tree menu with treeview , having the option persist set to cookie. When I click a submenu of a particular menu then I call an ajax to retrieve database data and rewrite accordingly the code of the HTML unordered list of the tree menu, then I rebuild the menu by calling treeview .

In that ajax I call session_start() at the beginning. My question is : does session_start() clear any previously set cookie ?

否。它可能会添加另一个cookie作为会话cookie,并且如果该cookie名称与任何先前设置的cookie冲突,则该cookie可能会被删除或覆盖或对PHP不可访问,但这不是通常的情况。

session_start allow you to manage sessions:

1- take control over an existing session

2- create new session

  • manipulate some header directive

Unless your first cookie is set using the $_SESSION variable then they shouldn't affect each other. Regular cookies and PHP sessions are independent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM