Laravel-Dompdf 超过 60 秒的最大执行时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49421226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 17:32:40  来源:igfitidea点击:

Laravel- Dompdf Maximum execution time of 60 seconds exceeded

laravelpdflaravel-5.3

提问by Thanh Toàn

Here is error when i convert pdf, it's not working since i run my laravel project by "php artisan serve --port=1000". But if i run my laravel project with xampp. it's alright. I don't know why?. Give me explaination and repairs . Thank you

这是我转换 pdf 时的错误,它不起作用,因为我通过“ php artisan serve --port=1000”运行我的 Laravel 项目。但是如果我用 xampp 运行我的 laravel 项目。没关系。我不知道为什么?。给我解释和修理。谢谢

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
    Maximum execution time of 60 seconds exceeded

回答by AddWeb Solution Pvt Ltd

Increase Your time limit in your controller file.Below variable to increase your time limit.

增加您在控制器文件中的时间限制。以下变量可增加您的时间限制。

 set_time_limit(300);

回答by Rodrigo Basilio

The laravel - dompdf does not work well with php artisan serve. You should use XAMPPor another HTTP serveryou like.

laravel-dompdf 不能很好地与php artisan serve. 您应该使用XAMPP或其他您喜欢的HTTP 服务器

回答by user558720

I had the same problem and narrowed it down to linking to an image in my blade file. When I embedded the image instead as per this SO answer, it no longer timed out.

我遇到了同样的问题,并将其缩小到链接到我的刀片文件中的图像。当我按照这个SO answer嵌入图像时,它不再超时。

回答by SirVineyard

Possible causes:

可能的原因:

linking to external CSS- you're better off writing your css between style tags in the same file as your html

链接到外部 CSS- 最好在与 html 相同的文件中的样式标记之间编写 css

using blade templating syntaxe.g. @sections @roles, etc

使用刀片模板语法,例如@sections @roles 等

linking to external images

链接到外部图像

Complex table structures/layouts

复杂的表结构/布局

...from personal experience

...从个人经验