How to delete only an element in a session-php Tutorial

Source: Internet
Author: User
How to delete only one element in a session? Example: session (0 & gt; array (0 & gt; aa, 1 & gt; bb), 1 & gt; array (0 & gt; cc, 1 & gt; dd) now, only aa needs to be deleted. can this be implemented? If unset is not used, the entire sessiondestory will be dropped. ------ solution ------------------ how does unse delete only one element in the session?
For example:
Session (0 => array (0 => 'A', 1 => 'BB'), 1 => array (0 => 'CC ', 1 => 'DD '))
Now, you only need to delete aa. can this be implemented?

If unset is used, the entire session destory will be dropped.

------ Solution --------------------
Unset (session ['username'])
------ Solution --------------------
Session_start ();
Unset ($ _ SESSION [0] [0]);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.