For php beginners, convert asp code into php & lt; % dim & nbsp; user & nbsp; session (& quot; user & quot;) if & nbsp; user & quot; & nbsp; then & nbsp; for php beginners, convert 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 (){
}
?>