//从内存查询 表 以防止多次查库 private static function selectTable($tableName,array $where,$getFirst=false){ $res=array(); if(!isset(self::$tableData[$tableName])){ self::$tableData[$tableName]=M($tableName)->select(); } if(false===self::$tableData[$tableName]){ return false; } is_null(self::$tableData[$tableName]) and self::$tableData[$tableName]=array(); foreach(self::$tableData[$tableName] as $val){ $flag=true; foreach($where as $k=>$v){ if($val[$k]!=$v){ $flag=false; break; } } $flag and $res[]=$val; } $getFirst and $res=current($res); empty($res) and $res=null; return $res; }