切换导航条
此项目
正在载入...
登录
周海龙
/
mail-serve
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
4 months ago
提交
cb1156250444dc695fb8924c123807d60a50b6c2
1 个父辈
7d63fa94
优化
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
33 行增加
和
0 行删除
lib/App.php
lib/App.php
查看文件 @
cb11562
...
...
@@ -64,6 +64,12 @@ class App {
private
array
$error
=
[];
/**
* 前端提交过来的body内容
* @var
*/
private
$bodyRaw
=
''
;
/**
* App constructor.
*/
public
function
__construct
()
...
...
@@ -80,6 +86,13 @@ class App {
// 请求参数 TODO::不允许其他类型的请求参数
$this
->
request
=
my_filter
(
$_REQUEST
,[
'trim'
]);
// 提交到服务器的body 内容
$this
->
bodyRaw
=
file_get_contents
(
"php://input"
);
$josnBody
=
$this
->
getBodyRawJson2Array
();
if
(
$josnBody
){
$this
->
request
=
array_merge
(
$josnBody
,
$this
->
request
);
}
// 调试
if
(
defined
(
'APP_DEBUG'
)){
...
...
@@ -191,6 +204,26 @@ class App {
}
/**
* body请求内容
* @return false|string
* @author:dc
* @time 2024/12/17 9:57
*/
public
function
getBodyRaw
(){
return
$this
->
bodyRaw
;
}
/**
* json 数据 body里面的
* @return mixed
* @author:dc
* @time 2024/12/17 9:51
*/
public
function
getBodyRawJson2Array
(){
return
json_decode
(
$this
->
bodyRaw
,
true
)
?
:
[];
}
/**
* 读取数组
* @param string $name
* @param array $default
...
...
请
注册
或
登录
后发表评论