Several supplementary functions about session (1)_PHP tutorial

WBOY
Release: 2016-07-13 17:21:56
Original
787 people have browsed it

Under PHP, there is a lot of discussion about session. In fact, there are several functions in PHP4 that we usually don't notice.
Let me introduce them to you below.
The session_set_save_handler() is really a good thing.
//**********************
session_unset (PHP4 $#@62;= 4.0b4)
void session_unset(void);
This function can set all registered session variables to empty. Note that it is not unregister, nor is it the same as destroy.
The following example provides a good explanation of this function.
$#@60;?php
session_register("a","b","c"); //auto-session-start
$a=1;
$b=2 ;
$c=3;
session_unregister("a"); //unregistrered $a
echo "A: $a - reg:".session_is_registered("a")."
" ; // but the global $a remains
session_unset(); // unsets $b und $c
echo "B:$b - reg:".session_is_registered("b")."
" ; // the registration remains !
echo "C:$c - reg:".session_is_registered("c")."
";
echo session_encode();
?$#@62 ;
Output:
A: 1 - reg:
B: - reg:1
C: - reg:1
!b|!c|

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532387.htmlTechArticleIn PHP, there are many discussions about session. In fact, there are several functions in PHP4 that we usually don’t pay attention to. Arrived. Let me introduce them to you below. Among them, session_set_save_...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!