PHP adjustment interface Sign verification

不言
Release: 2023-03-25 17:46:02
Original
1949 people have browsed it

This article mainly introduces the verification of the PHP adjustment interface Sign. It has a certain reference value. Now I share it with everyone. Friends in need can refer to it.

 $v) {
            if ($k == 'sign' || $k == 'ts') {
                continue;
            }
            if (is_array($v)) {
                $v = json_encode($v);
            }
            $strTmp = trim($k) . '=' . trim($v);
            $arrSign[$strTmp] = $strTmp;
        }
        $strSign = implode('&', $arrSign);
        $sign = md5($strSign.$ts.$token);
        return $sign;
    }

}
Copy after login
   $params = $request->all();  
if(!isset($params['sign'])){  
    return $this->failsmsg('缺少sign校验参数');  
}  
$mySign = SignUtil::getCheckSign($params);  
if($params['sign'] != $mySign){  
    return $this->failsmsg('sign校验失败');  
}
Copy after login

The above is the entire article. Content, please pay attention to the PHP Chinese website for more related content.

Related recommendations:

Detailed explanation of SQLite PHP interface

The meaning of interface in php interface

The above is the detailed content of PHP adjustment interface Sign verification. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!