业务相关的请求参数放在body 必须传的放在header
image.pngCommon.php
<?php
/**
* Created by PhpStorm.
* User: tong
* Date: 2017/11/15
* Time: 15:33
*/
namespace app\api\controller;
use think\Controller;
class Common extends Controller
{
/**
* 初始化的方法
*/
protected function _initialize()
{
$this->checkRequestAuth();
}
/**
* 检查每次app请求的数据是否合法
*/
public function checkRequestAuth()
{
//首先需要获取headers
$headers=request()->header();
halt($headers);
}
}
Test.php
class Test extends Common
image.png
网友评论