gpt4 book ai didi

php - fatal error : Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)?

转载 作者:行者123 更新时间:2023-12-02 17:11:40 24 4
gpt4 key购买 nike

我在 PHP 中使用重载,我的 PHP 代码有什么问题,即使它只有 8 行代码:

class c1{
public function __call($name,$array){
if($this->$name()){ return true;}
}
}

$cl = new c1;
echo $cl->m1();

它说:

fatal error :允许的 134217728 字节内存已耗尽(已尝试分配 262144 字节)

最佳答案

你正在使用这段代码进行无限循环:

if($this->$name()){ 返回真;}

这一行调用了 __call,__call 调用了 __call,等等,因为函数“m1”没有定义。

关于php - fatal error : Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48916108/

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