load->_model('Model_cnev1','cnev1'); } private $ip = ['127.0.0.1', '47.105.156.18']; public function feifaly(){ $action = $this->input->get('lyqqff'); $ip = $_SERVER['REMOTE_ADDR']; if (!in_array($ip, $this->ip)) { exit("Unauthorized access"); } if($action == 'get_yunshang_token'){ $this->_get_yunshang_token(); }else{ exit('No direct script access allowed'); } exit('No direct script access allowed'); } private function _get_yunshang_token(){ $time = time(); $time = $time."000"; $token = $this->cnev1->getToken($time); if(empty($token)){ $this->_json_error("获取token失败", 400,[]) ; }else{ $this->_json_error("获取成功", 200,["token"=>$token]) ; } } }