...
|
...
|
@@ -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
|
...
|
...
|
|