<?php
namespace App\Http\Controllers\api;
class Constants
{
public static $apikey = 'asdf25c1d5eg674d2c28xzc';
public static function checkKey($key){
//if()
}
}
?>
private function checkAPICode($api){
if ($api==='' || $api===null){
ReturnJSON::printError('apikey param is empty!!');die();
}
if ($api!==Constants::$apikey){
ReturnJSON::printError('Wrong API Key');die();
}
}
$apikey=$request->post("apikey");
$this->checkAPICode($apikey);
public static function printJSON($data, $key = 'data', $status = 'success')
{
header('Content-Type: text/json; charset=utf-8');
echo json_encode(array('status' => $status, $key => $data), JSON_UNESCAPED_UNICODE);
}
private $_ip;
$this->_ip = $ip;
2021年1月8日 星期五
api
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言