php Laravel“最大执行时间超过60秒”

23c0lvtd  于 2023-10-15  发布在  PHP
关注(0)|答案(1)|浏览(152)

所以我尝试在php.ini中更改max_execution_time=1800,但在我的“view”中出现了相同的错误。
在我的web.php

Route::get('/article', array('as' => 'accueil', function()
{
  $categories = \App\Categorie::latest()->get();
  $articles = \App\Article::select('id', 'title', 'intro_text')->orderBy('created_at', 'desc')->get();
  return view('accueil', ['categories' => $categories, 'articles' => $articles, 'actif' => 0]);  
}));

我认为这是一个返回视图的问题

30byixjq

30byixjq1#

我添加了set_time_limit(0),它的工作,像这样

Route::get('/article', array('as' => 'accueil', function()
{
  $categories = \App\Categorie::latest()->get();
  $articles = \App\Article::select('id', 'title', 'intro_text')->orderBy('created_at', 'desc')->get();
set_time_limit(0);
  return view('accueil', ['categories' => $categories, 'articles' => $articles, 'actif' => 0]);  
}));

相关问题