protected static function Eexecute($conn, $sql, $executeArray = array(), $isSelect = FALSE) { try { if (defined('MEMCACHE_START')) { $data = MyMemcache::getCache($sql); if (!empty($data)) { return $data; } } $startTime = microtime(TRUE); $STMT = $conn->prepare($sql); $result = empty($executeArray) ? $STMT->execute() : $STMT->execute($executeArray); if ($result) { if (DEBUG) { if (!empty($executeArray)) { $SQL = self::comSQL($sql, $executeArray); } //好方法 $SQL = empty($SQL) ? $sql : $SQL; } if ($isSelect) { while ($row = $STMT->fetch(PDO::FETCH_ASSOC)) { $data[] = $row; } self::StopTime($SQL, $startTime); if (defined('MEMCACHE_START')) { //缓存结果集到Memcache中 MyMemcache::addCache(self::$tabName, $sql, $data); } return empty($data) ? NULL : $data; } else { if (strstr($sql, 'insert')) { self::StopTime($SQL, $startTime); return self::$InsertId = $conn->lastinsertid(); } self::StopTime($SQL, $startTime); return $STMT->rowCount(); //受影响行,这个只针对update,delete } } else { if (DEBUG) { Debug::addmsg('<font color="red">请检查您的SQL: ' . $sql . '</font>', 2); } } } catch (PDOException $e) { if (DEBUG) { MyException::Exceptions('请确认您的SQL语句:<b>' . $sql . '</b><br />' . $e->getMessage(), $e->getTrace()); } } }