gpt4 book ai didi

分配 64 字节时 PHP PDO 允许内存耗尽

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:28 26 4
gpt4 key购买 nike

<分区>

我有 2 个技术上相同的脚本,但一个有效,另一个产生错误:

( ! ) Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 64 bytes) in C:\wamp\www\SOTag\SOTag.php on line 29

第 29 行是:

$rows[] = $r;

这是有效的代码:

$this->connect_db();
$statement = $this->db_connection->prepare("SELECT * FROM tags WHERE tag LIKE :keywords");
$statement->bindParam(':keywords', $keywords, PDO::PARAM_INT);
$statement->execute(compact('keywords'));

$rows = array();
while($r = $statement->fetch(PDO::FETCH_ASSOC)) {
$rows[] = $r;
}
return json_encode($rows);

这就是我需要做的(因为我需要检查结果)但失败了:

$this->connect_db();
$statement = $this->db_connection->prepare("SELECT * FROM tags WHERE tag LIKE :keywords");
$statement->bindParam(':keywords', $keywords, PDO::PARAM_INT);
$statement->execute(compact('keywords'));
$result = $statement->fetch(PDO::FETCH_ASSOC);

$rows = array();
while($r = $result) {
$rows[] = $r;
}
return json_encode($rows);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com