美文网首页
[PHP高可用后端]②③--数据安全解决方案开篇

[PHP高可用后端]②③--数据安全解决方案开篇

作者: 子木同 | 来源:发表于2017-11-15 15:44 被阅读26次
image.png image.png image.png image.png image.png

业务相关的请求参数放在body 必须传的放在header

image.png

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

相关文章

网友评论

      本文标题:[PHP高可用后端]②③--数据安全解决方案开篇

      本文链接:https://www.haomeiwen.com/subject/plthvxtx.html