如何在 Yii 2.0 的 Web 应用程序中调用控制台命令 [英] How can I call a console command in web application in Yii 2.0

查看:18
本文介绍了如何在 Yii 2.0 的 Web 应用程序中调用控制台命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制台命令来生成用户报告.我想从我的 Web 应用程序中调用它.我正在使用 Yii 2.0.0 测试版.我试图按照这篇文章中给出的答案 如何在 Yii 中的 web 应用程序操作中调用控制台命令?

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 post How to call a console command in web application action in Yii?

由于 Yii 2.0 的结构与 Yii 1.1 非常不同,如果我尝试包含 command/userReportController.php 会出错.有人可以指导我吗?

Since Yii 2.0 structure is very different from Yii 1.1 ,I get errors if I try to include command/userReportController.php .Can someone guide me on this?

推荐答案

你应该使用像 https://github.com/vova07/yii2-console-runner-extension

这篇关于如何在 Yii 2.0 的 Web 应用程序中调用控制台命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆