Home > php教程 > php手册 > php中cookie操作实例

php中cookie操作实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:28:49
Original
1677 people have browsed it

php中cookie操作实例

   做了一个cookie操作的实例,第一个文件login_frm.PHP这个是登录窗口。

  代码 1

  2

  3

  4

  5

  6

 

  10

  11

  第二个文件login.php这个是处理登录

  1

  2 if($_POST['username'] = 'admin')

  3 {

  4 setcookie('haha','gogo');

  5 header("location:index.php");

  6 }

  7 ?>

  第三个文件index.php再看下效果

  1

  2 if($_COOKIE['haha'] == 'gogogo')

  3 {

  4

  5 echo $_COOKIE['haha'];

  6 echo'你设置了cookie';

  7 }

  8 else

  9 {

  10 echo'你没有设置cookie';

  11 }

  12 ?>

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