PHP beginner, the ASP code to PHP

Source: Internet
Author: User
Tags setcookie
Help PHP Beginner, the ASP code to 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, 2036#
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 ()
{
;
}

?>


I remember that the ASP = number is also assigned, ah, if user= "" is to determine whether the user is empty or empty value?
------Solution--------------------
I remember that the ASP = number is also assigned, ah, if user= "" is to determine whether the user is empty or empty value?
----------------------------

At the time of judgment is judgment, in devaluation is the time is devaluation.

If user= "" judgment

User= "" devaluation.
------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 () {

}
?>
  • Related Article

    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.