* @link http://www.jieone.com/*/class Token extends rsa{/** * Client unique ID */private $date =0;private $clientID = "ABCCCCC";/** * System Access_token, that is, data to be stored on the client */private function Sys_access_token () {$array =array (' clientID ' = = $this->clientid, ' Date ' = $this->date), $sys _access_token = Json_encode ($array),//RSA public key encryption return $this->public_encrypt ($sys _ Access_token);} /** * Save Access_token */public function Get_access_token () {if (Empty ($_cookie[' Access_token '])) {$this->date=time () -100;return $this->sys_access_token (); } return $_cookie[' Access_token '];} /** * Save Access_token */private function Save_access_token () {Setcookie ("Access_token", $this->sys_access_token ());} Public function Check () {$access _token= $this->get_access_token ();//rsa private key decryption $access_token = $this->private_ Decrypt ($access _token);//information has been illegally tampered with if (empty ($access _token)) {return false;} $object =json_decode ($access _token);//2 seconds can only be Ajax requested once, can modify if ($object->date + 2 > Time ()) {return false;} Save Access_token$this->date=time ();$this->save_access_token (); return true;}} Echo '
Frequent refresh try
'; $Token =new Token (); if (! $Token->check ()) {echo '
You requested too fast, please try again later
'; exit ();} Echo '
Access to normal
'; Echo ' Your current Access_token: '. $Token->get_access_token ();
The above describes the PHP limit of frequent requests, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.