How can I call a console command in web application in Yii 2.0

后端 未结 5 922
余生分开走
余生分开走 2020-12-19 13:37

I have a console command to generate user report. I want to call the same from my web application. I am using Yii 2.0.0 beta version.I tried to follow answers given in this

5条回答
  •  旧巷少年郎
    2020-12-19 13:59

    yii2-console-runner-extension keeps loading.

    Try this:

    It's yii (without ext, not yii.bat)

    Make sure that php folder added to PATH variable (Windows)

    $op = shell_exec ( 'absolute/path/to/yii ' . 'cache/flush-all' );
    \yii\helpers\VarDumper::dump($op, 10, 1);
    

    Output:

    The following cache components were processed:
    
    * cache (yii\\caching\\FileCache)
    

提交回复
热议问题