/** * 执行增删改操作,返回受影响的记录的条数 * @param string $sql * @return boolean|unknown */ public static function execute($sql = null) { $link = self::$link; if (!$link) { return false; } self::$queryStr = $sql; if (!empty(self::$PDOStatement)) { self::free(); } $result = $link->exec(self::$queryStr); self::haveErrorThrowException(); if ($result) { self::$lastInsertId = $link->lastInsertId(); self::$numRows = $result; return self::$numRows; } else { return false; } }