错误504网关超时

时间:2017-01-26 11:54:36

标签: yii2

我从网站下载excel文件时遇到问题。我用kartik \ export \ ExportMenu;我在脚本中加入了这个视图:

 <?php
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
$gridColumns = [
    'order_number',
    [

但它没有帮助。我怎么能修好它?

public function actionIndex()
{
    $searchModel = new OrderSearch();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    return $this->render('index', [
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,
    ]);
}

2 个答案:

答案 0 :(得分:1)

有三种配置可以帮助以防超时但不能保证。

ExportMenu窗口小部件配置中设置的选项:

  1. Large Files Linking

    'stream' => false
    
  2. Large Files Streaming

    'stream' => false, // this will automatically save the file to a folder on web server
    'streamAfterSave' => true, // this will stream the file to browser after its saved on the web folder 
    'deleteAfterSave' => true, // this will delete the saved web file after it is streamed to browser,
    'target' => '_blank',
    
  3. Batch Loading

    'batchSize' => 10,
    'target' => '_blank',
    

答案 1 :(得分:0)

尝试增加max_execution_time

 <?php
    ini_set('max_execution_time', 3600); //3600 seconds = 60 minutes
       $gridColumns = [
       'order_number',
  [