namespaceAddons\Coupon\Controller; UseHome\Controller\Addonscontroller; classwapcontrollerextendsaddonscontroller{protected$model; Public function__construct() {$GLOBALS[' Is_wap '] =true;Parent:: __construct ();$uid= Get_uid_by_openid ();$this->model = Getmodelbyname (' Coupon ');$this->model | |$this->error (' model is not found! '); }/ * * Create Coupon code * * @param $namespace String * @return $guid String * @author Sun * *Private functioncreate_guid($namespace = ") {Static$guid='';$uid= Uniqid ("",true);$data=$namespace;$data.=$_server[' Request_time '];$data.=$_server[' Http_user_agent '];$data.=$_server[' local_addr '];$data.=$_server[' Local_port '];$data.=$_server[' REMOTE_ADDR '];$data.=$_server[' Remote_port '];$hash= Strtoupper (Hash (' ripemd128 ',$uid.$guid. MD5 ($data)));//Test str combination$guid= substr ($hash,0,6) .'-'. Substr$hash,8,4) .'-'. Substr$hash, A,4) .'-'. Substr$hash, -,4) .'-'. Substr$hash, -,8);return$guid; }}//End
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the php/thinkphp create coupon code, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.