From 7fdc4d2cff6868e012e44c7fb74b8141926251cd Mon Sep 17 00:00:00 2001 From: xtgxiso <124960772@qq.com> Date: Wed, 15 Feb 2017 15:25:57 +0800 Subject: [PATCH] setcookie --- App.php | 8 ++++++-- README.md | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/App.php b/App.php index 8d2b5da..9eaeb0a 100644 --- a/App.php +++ b/App.php @@ -17,7 +17,7 @@ class App extends Worker * * @var string */ - const VERSION = '0.2.3'; + const VERSION = '0.2.4'; private $conn = false; private $map = array(); @@ -183,7 +183,11 @@ public function ServerHtml($data){ public function Header($str){ Http::header($str); } - + + public function setcookie($name,$value = '',$maxage = 0,$path = '',$domain = '',$secure = false,$HTTPOnly = false){ + Http::setcookie($name,$value,$maxage,$path,$domain,$secure,$HTTPOnly); + } + public function run() { autoload_dir($this->autoload); diff --git a/README.md b/README.md index 188488d..ba045b3 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ $app->HandleFunc("/json",function() { $app->HandleFunc("/",function() { //自定义响应头 $this->Header("server: xtgxiso"); + //设置cookie + $this->setcookie("xtgxiso",time()); //以json格式响应 $this->ServerJson(array("name"=>"WebWorker")); });