From de66e34b399659147dc94de751078abe770b1a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= <790604007@qq.com> Date: Thu, 2 Jun 2022 14:11:27 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220601--Cookie\345\222\214Session.md" | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 "\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" diff --git "a/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" new file mode 100644 index 0000000..659f483 --- /dev/null +++ "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" @@ -0,0 +1,166 @@ +## Cookie和Session + + + +#### Cookie + +- setcookie() 函数用于设置 cookie。 + +- setcookie() 函数必须位于 标签之前。 + +```php +setcookie(name, value, expire); +``` + +设置cookie时间 + +```php +time()+60*60*1; +``` + +删除cookie + +```php +time()-1; +``` + + + +#### Session + +启动会话 **session_start();** + +储存Session变量 + +```php +进入"; + }else { + echo "登录失败!返回"; + } +}else{ + +?> + + + + + + 登录 + + +
+ 用户名: +
+ 密码: +
+ +
+ + + + + +``` + +##### 退出登录 + +```php +重新登录"; + +``` + +##### 首页 + +```php +登录"; + exit(); +} +?> + + + + + + 首页 + + +

欢迎!!!

+
+ + + + + + + + + + + + + + + + + + + + + +

姓名:

张三

性别:

年龄:

20

职位:

法外狂徒

余额:

-1000000元

+
+ + + +``` + -- Gitee From cfb1ed09ec249a2941a98cc02f8c5a943801af8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= <790604007@qq.com> Date: Thu, 2 Jun 2022 14:52:24 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220601--Cookie\345\222\214Session.md" | 3 +++ 1 file changed, 3 insertions(+) diff --git "a/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" index 659f483..004e742 100644 --- "a/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" +++ "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" @@ -157,6 +157,9 @@ if (empty($user)){

余额:

-1000000元

+ + 退出登录 + -- Gitee From 37665c1daa81b545b7bd3394ad924105b21cf6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= <790604007@qq.com> Date: Thu, 2 Jun 2022 14:54:08 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E9=9F=A6=E7=BB=8D=E4=B8=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20220601--Cookie\345\222\214Session.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" index 004e742..92da04d 100644 --- "a/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" +++ "b/\351\237\246\347\273\215\344\270\245/20220601--Cookie\345\222\214Session.md" @@ -158,7 +158,7 @@ if (empty($user)){

-1000000元

- 退出登录 + 退出登录 -- Gitee