thinkphp创建临时表
/** *创建临时表存储设备 **/ public function createTmptable(){ $model = M(); $prefix = C('DB_PREFIX'); $sql = "CREATE TEMPORARY TABLE ".$prefix."devicetmp(`id` int(10) unsigned NOT NULL AUTO_INCREMENT,`devcode` varchar(64),`address` varchar(255),`location_id` int(10),`type` int(10),`wacode` varchar(64),`kfccode` varchar(64),PRIMARY KEY (`id`)) "; //echo $sql;exit; $model->execute($sql); }
查询的时候和其他表一样,唯一的就是每次就要创建一次有点影响性能
$devicetmp = M('devicetmp'); $data = $devicetmp->select();