浅解用PHP实现MVC( 七 )


$data = https://www.isolves.com/it/cxkf/yy/php/2019-12-16/$stmt->fetchAll(PDO::FETCH_ASSOC);
?
if ($addcache) {
$mem->addCache($this->tabName, $memkey, $data);
}
$return = $data;
break;
case "find": //只要一条记录的
$data = https://www.isolves.com/it/cxkf/yy/php/2019-12-16/$stmt->fetch(PDO::FETCH_ASSOC);
?
if ($addcache) {
$mem->addCache($this->tabName, $memkey, $data);
}
$return = $data;
break;
?
case "total": //返回总记录数
$row = $stmt->fetch(PDO::FETCH_NUM);
?
if ($addcache) {
$mem->addCache($this->tabName, $memkey, $row[0]);
}
?
$return = $row[0];
break;
case "insert": //插入数据 返回最后插入的ID
if ($this->auto == "yes")
$return = $pdo->lastInsertId();
else
$return = $result;
break;
case "delete":
case "update": //update
$return = $stmt->rowCount();
break;
default:
$return = $result;
}
$stopTime = microtime(true);
$ys = round(($stopTime - $startTime), 4);
Debug::addmsg('[用时<font color="red">' . $ys . '</font>秒] - ' . $memkey, 2); //debug
return $return;
} catch (PDOException $e) {
Debug::addmsg("<font color='red'>SQL error: " . $e->getMessage() . '</font>');
Debug::addmsg("请查看:<font color='#005500'>" . $memkey . '</font>'); //debug
}
}

【浅解用PHP实现MVC】


推荐阅读