Cmd 如何在框架yii2中运行.bat

Cmd 如何在框架yii2中运行.bat,cmd,yii2,Cmd,Yii2,我有一个.bat文件,其中包含以下代码 ftp.bat 如何运行.bat文件 控制器 public function actionCommand(){ shell_exec('%windir%\explorer.exe ftp://2.180.25.199/'); return $this->render('index', [ 'dataProvider' => $dataProvider, ]);} 将批处理文件命名为ftp是个坏主意,因

我有一个.bat文件,其中包含以下代码

ftp.bat

如何运行.bat文件

控制器

public function actionCommand(){
    shell_exec('%windir%\explorer.exe ftp://2.180.25.199/');

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

将批处理文件命名为
ftp
是个坏主意,因为存在同名的可执行文件;因此,除非指定扩展名
.bat
,否则可能会执行错误的文件…
public function actionCommand(){
    shell_exec('%windir%\explorer.exe ftp://2.180.25.199/');

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