For php beginners, convert asp code into php & lt; % dim & nbsp; user = & nbsp; session (& quot; user & quot;) if & nbsp; user = & quot; & nbsp; the php beginner who converts asp code into php
<%
Dim user
User = session ("user ")
If user = "" then
User = Request. Cookies ("user ")
If user = "" then
User = getuser ()
Response. Cookies ("user") = user
Response. Cookies ("user"). Expires = # January 01,203 6 #
End if
End if
Session ("user") = user
Function getuser ()
;
End function
%>
------ Solution --------------------
$ User = $ _ SESSION ('user ');
If ($ user = ''){
$ User = $ _ COOKIE ('user ');
If ($ user = ''){
$ User = getuser ();
Setcookie ('user', user, time () + 30*365*24*60*60 );
}
}
$ _ SESSION ('user') = $ user;
Function getuser (){
}
?>
------ Solution --------------------
$ User = $ _ SESSION ['user'];
If ($ user = "")
{
$ User = $ _ COOKIE ['user'];
If ($ user = "")
{
$ User = getuser ();
Setcookie ("user", $ user, 99999999 );
}
}
$ _ SESSION ['user'] = $ user;
Function getuser ()
{
;
}
?>
In my impression, asp = is also assigned a value. if user = "" is used to determine whether the user is empty or null?
------ Solution --------------------
In my impression, asp = is also assigned a value. if user = "" is used to determine whether the user is empty or null?
----------------------------
When judging, it is determined that the devaluation is the time.
If user = "" Judgment
User = "" depreciation.
------ Solution --------------------
Is auto to comp
------ Solution --------------------
$ User = $ _ SESSION ('user ');
If ($ user = ''){
$ User = $ _ COOKIE ('user ');
If ($ user = ''){
$ User = getuser ();
Setcookie ('user', user, time () + 30*365*24*60*60 );
}
}
$ _ SESSION ('user') = $ user;
Function getuser (){
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.