我需要生成一个网站地图。
我正在使用spatie/laravel-sitemap。我已经安装并发布了它,但是当我运行生成器时,Symphony抛出了一个致命错误:Maximum execution time of 60 seconds exceeded。
我有一个很大的链接列表,只留下一个要测试,但仍然得到相同的错误。
如何解决这个问题?下面是我的web.php代码:
<?php
use Spatie\Sitemap\SitemapGenerator;
// this link throws a fatal error: Maximum execution time of 60 seconds exceeded
Route::get('sitemap', function(){
SitemapGenerator::create('127.0.0.1:8000')->writeToFile('sitemap.xml');
return 'sitemap created';
});
// this link is tested and fully working
Route::get('', function () {
return view('home');
});发布于 2019-01-08 22:46:49
这是使用长时间运行的脚本时的常见问题。
你有没有试过使用php函数set_time_limit?
尝试在脚本的开头添加内容
set_time_limit(300);
https://stackoverflow.com/questions/54093978
复制相似问题