Home > Backend Development > PHP Tutorial > php初学,将asp代码转为php

php初学,将asp代码转为php

WBOY
Release: 2016-06-13 13:38:19
Original
848 people have browsed it

求助php初学,将asp代码转为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
%>

------解决方案--------------------

$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(){

}
?>
------解决方案--------------------
$user=$_SESSION[ 'user '];
if($user== " ")
{
$user=$_COOKIE[ 'user '];
if($user== " ")
{
$user=getuser();
setcookie( "user ",$user,99999999);
}
}
$_SESSION[ 'user ']=$user;

function getuser()
{
;
}

?>


我印象里,asp的=号也是赋值的啊,if user= " "是判断user为空还是赋空值?
------解决方案--------------------
我印象里,asp的=号也是赋值的啊,if user= " "是判断user为空还是赋空值?
----------------------------

在判断的时候是判断,在贬值的是时候是贬值.

if user= " " 判断

user= " " 贬值.
------解决方案--------------------
is auto to comp
------解决方案--------------------

$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 labels:
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