FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
flask-php/src/Response.php at master · Web-Engine/flask-php · GitHub
Web-Engine
/
flask-php
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
flask-php
/
src
/
Response.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (63 loc) · 2.12 KB
Breadcrumbs
flask-php
/
src
/
Response.php
Copy path
File metadata and controls
82 lines (63 loc) · 2.12 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace
FlaskPHP
;
class
Response {
private
$
headers
= [];
private
$
content
=
''
;
private
$
contentLength
=
0
;
private
$
contentType
=
''
;
private
$
charset
=
''
;
public
function
__construct
(
$
content
,
$
contentType
=
'
text/html
'
,
$
charset
=
'
utf-8
'
) {
$
this
->
setContent
(
$
content
);
$
this
->
setContentType
(
$
contentType
,
$
charset
);
}
public
function
setCookie
(
$
name
,
$
value
=
NULL
,
$
expire
=
NULL
,
$
path
=
NULL
,
$
domain
=
NULL
,
$
secure
=
NULL
,
$
httponly
=
NULL
) {
setcookie
(
$
name
,
$
value
,
$
expire
,
$
path
,
$
domain
,
$
secure
,
$
httponly
);
}
public
function
setHeader
(
$
header
,
$
content
=
NULL
) {
if
(
$
content
===
NULL
) {
if
(
strpos
(
$
header
,
'
:
'
) ===
FALSE
) {
array_push
(
$
this
->
headers
,
$
header
);
return
;
}
list
(
$
header
,
$
content
) =
explode
(
'
:
'
,
$
header
,
2
);
}
$
header
=
str_replace
(
'
'
,
'
-
'
,
ucwords
(
str_replace
(
'
-
'
,
'
'
,
$
header
)));
$
this
->
headers
[
$
header
] =
$
content
;
}
public
function
setContentType
(
$
contentType
,
$
charset
=
'
utf-8
'
) {
$
this
->
contentType
=
$
contentType
;
$
this
->
charset
=
$
charset
;
$
this
->
setHeader
(
'
Content-Type
'
,
"{
$
contentType
}
; charset=
{
$
charset
}"
);
}
public
function
getContentType
() {
return
$
this
->
getHeader
(
'
Content-Type
'
);
}
public
function
getHeader
(
$
header
) {
return
$
this
->
headers
[
$
header
];
}
public
function
getAllHeader
(
$
header
) {
return
$
this
->
headers
;
}
public
function
getContent
() {
return
$
this
->
content
;
}
public
function
setContent
(
$
content
) {
$
this
->
content
=
$
content
;
$
this
->
contentLength
=
strlen
(
$
content
);
}
public
function
getCharset
() {
return
$
this
->
charset
;
}
public
function
setCharset
(
$
charset
) {
$
this
->
charset
=
$
charset
;
}
public
function
getContentLength
() {
return
$
this
->
contentLength
;
}
public
function
printAll
() {
foreach
(
$
this
->
headers
as
$
header
=>
$
value
) {
header
(
"{
$
header
}
:
{
$
value
}"
);
}
echo
$
this
->
getContent
();
}
}
Back
|
FazBrowse Home
|
New Git URL