m_name}'"; if($this->sqlone('applist',$where) != false){ echo '请勿重复安装'; return '请勿重复安装'; exit; } do{ $this->no = mt_rand(2001,9999); $stall = $this->sqlone('applist'); } while ($stall != false); //开始执行程序[需要的东西可以在下面执行了] $this->appsql(); echo '安装成功'; return '安装成功'; } //执行APP相关的表数据插入 private function appsql() { global $_M; //注册应用 $updatetime = time(); $field = "no='{$this->no}',ver='{$this->ver}',m_name='{$this->m_name}',m_class='application',m_action='doindex',appname='应用安装助手',info='应用开发必备工具!能够快速安装应用,不必每次都要拼写安装URL进行安装。',addtime='{$updatetime}'"; $this->addsql('applist',$field); } //公共查询方法 private function sqlone($tname,$where = '') { global $_M; $table = $_M['table'][$tname]; if(!$where){ $where = "no='{$this->no}'"; } return DB::get_one("select * from {$table} where {$where}"); } //公共写入方法 private function addsql($tname,$field) { global $_M; $table = $_M['table'][$tname]; DB::query("INSERT INTO {$table} SET {$field}"); } } ?>