FPDF致命错误:耗尽的33554432字节允许的内存大小(PHP) [英] FPDF Fatal error: Allowed memory size of 33554432 bytes exhausted (PHP)

查看:102
本文介绍了FPDF致命错误:耗尽的33554432字节允许的内存大小(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个经常讨论的问题,但到目前为止,没有解决方案适合我的问题. 我正在生成带有$ pdf = new FPDF()的pdf; .这很好.但是现在我想在页脚上添加页码.经过很多尝试,我发现,如果要设置页脚,则需要使用$ pdf = new yourPDFclassName();创建实例. (扩展了父FDF类).

This is a often discussed issue but so far no solution seems to fit for my problem. I'm generating a pdf with $pdf = new FPDF(); . This works fine. But now I want to have a footer with the page number. After trying a lot of things I found out, that if you want to set a footer, you need to create an instance with $pdf = new yourPDFclassName(); (which extends the parent FDF class).

再次运行整个程序,我收到错误消息:在第16行的/..blabla/yourPDFclassName.php中,允许的内存大小为33554432字节已用尽(尝试分配77字节)

Running the whole thing again I receive the error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 77 bytes) in /..blabla/yourPDFclassName.php on line 16

有人知道我调用子类时为什么会发生此错误吗?我的意思是它可以与父类一起使用...顺便说一句,77字节比33554432字节要小得多...嗯

Does anyone have an idea why this error occurs when I call the child class? I mean it works with the parent class... And btw, 77 bytes are much smaller than the 33554432 bytes ... hmm

class REPORTSPDF extends FPDF { .... }

16: $pdf = new REPORTSPDF();

第16行在REPORTSPDF的构造函数中.第16行之前没有其他行.只是在调用$ pdf = new REPORTSPDF()时崩溃.

The line 16 is in the constructor of REPORTSPDF. There are no other lines before line 16. It just crashes when $pdf = new REPORTSPDF() is called.

没有页脚功能,我有同样的错误.奇怪的是,当我将第16行更改为

Without the Footer function I have the same error. The weird thing is that when I change line 16 to

$pdf = new FPDF();

一切正常(除了我没有页脚).

everything works fine (with the exception that I don't have a footer).

推荐答案

听起来像您的代码中存在无限循环.尝试做一个简单的hello-world-test ans,看看会发生什么并检查代码中的所有循环.

sounds like you have an infinite loop in you code. try to do a simple hello-world-test ans see what happens and check all loop in your code.

这篇关于FPDF致命错误:耗尽的33554432字节允许的内存大小(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆