FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/apps/controllers/Http.php at master · feter/framework · GitHub
feter
framework
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
apps
/
controllers
/
Http.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (30 loc) · 737 Bytes
Breadcrumbs
framework
/
apps
/
controllers
/
Http.php
Copy path
File metadata and controls
35 lines (30 loc) · 737 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace
App
\
Controller
;
use
Swoole
;
class
Http
extends
Swoole
\Controller
{
function
stop
()
{
//请使用此函数代替exit
$
this
->
http
->
finish
(
"
<h1>exit</h1>
"
);
}
function
except
()
{
throw
new
\
Exception
(
"
except
"
);
}
function
goto_baidu
()
{
$
this
->
request
->
redirect
(
"
http://www.baidu.com/
"
);
}
function
header
()
{
//发送Http状态码,如500, 404等等
$
this
->
http
->
status
(
302
);
//使用此函数代替PHP的header函数
$
this
->
http
->
header
(
'
Location
'
,
'
http://www.baidu.com/
'
);
}
function
cookie
()
{
$
this
->
http
->
setcookie
(
"
swoole
"
,
"
framework
"
,
time
() +
3600
,
'
/
'
,
'
framework.com
'
);
}
}
Back
|
FazBrowse Home
|
New Git URL