Home > php教程 > php手册 > PHP学习系列之会话控制

PHP学习系列之会话控制

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:57:12
Original
1123 people have browsed it

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 header("Content-type:text/html;charset=utf-8"); ? form method="post" action="demo_setCookie2.php" name:input type="text" name="username" input type="submit" value="登录" /form ?php /

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

 

  header("Content-type:text/html;charset=utf-8");

  ?>

  

  name:

  

  

  

  /**

  * demo_setCookie2.php

  */

  if(isset($_POST["username"]) && $_POST["username"] == "benjamin"){

  //正确,生成一个cookie 再跳转

  setCookie("username","Benjamin");

  header("Location:demo_setCookieSuccess.php");

  }else{

  header("Location:demo_setCookie.php");

  }

  ?>

  

  /**

  * demo_setCookieSuccess.php

  */

  header("Content-type:text/html;charset=utf-8");

  if (isset($_COOKIE["username"])) {

  echo "欢迎光临".$_COOKIE["username"];

  }else{

  echo "非法登录";

  }

  ?>

  [1] [2] 

PHP学习系列之会话控制

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template