💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ## 使用 appkey 与 secretKey 参数验证 新建 `demo.php` 执行 `php -S 127.0.0.1:8081` ``` /*======= 加密 start =========*/ $appkey ="w12baqefaaoc"; $secretKey = "asjdKHKJHasjdIAHSdkASkdbaksjbdkjas"; $url ="http://127.0.0.1:8081/demo.php?"; $params['appkey'] = $appkey; $params['order_id']=1; $params['name']="idcpj"; $params['pwd']="123456"; $params['time']=time(); $params['sign'] = getSign($params,$secretKey); echo $url.http_build_query($params); function getSign($query,$secretKey){ ksort($query); $str = http_build_query($query); return md5($str.$secretKey); } /*======= 加密 end =========*/ /*======= 解密 start =========*/ $conf['w12baqefaaoc']="asjdKHKJHasjdIAHSdkASkdbaksjbdkjas"; $getParams = $_GET; if (abs(time() - $getParams['time'])>=3){//使用 abs 更加安全 die("<br/> time out"); } if (valiSign($getParams,$conf)){ die("<br/>succ"); }else{ die("<br/>error"); } function valiSign($params,$conf){ $paramsSign = $params['sign']; unset($params['sign']); ksort($params); $str = http_build_query($params); $cSign = md5($str.$conf[$params['appkey']]); return $paramsSign==$cSign; } /*======= 解密 end =========*/ ```