问题描述
我有一个想要运行的 Gams 应用程序它通过php代码在尝试了很多事情之后,我终于发现,为了在命令行中运行,我应该去 C:\Program Files\GAMS23.7
在命令行中运行一个命令来运行应用程序,如下所示:
I have a Gams application which I want to run it through php codeafter trying many things finally I found that for running in commmand line I should go to C:\Program Files\GAMS23.7
run a command in commandline for running the application as follows:
gams.exe trnsport_php.gms
现在将在命令行中成功运行 Gams 我想在 php 中运行它我添加了一个带有此路径的别名
the Gams wil be run successfully in commandline now I wanted to run it in php I added an alias with this path
C:\Program Files\GAMS23.7
然后我在那里创建了我的 php 文件当我想在 php 中使用此代码执行它时:
and then I created my php file in therewhen I want to exacute it with this code in php:
if(system('gams.exe trnsport_php.gms'))
echo 'Not Error';
else echo'Error';
它显示我错误
再次使用这个:
if(system('./gams.exe trnsport_php.gms'))
echo 'Not Error';
else echo'Error';
再次打印错误
我也试过 exec 但没有结果我不知道这里出了什么问题.这个也行不通:
I tried exec too but no result I don't know what is wrong here.this one also doesn't work:
if(system ("\"C:\\Program Files\\GAMS23.7\\gams.exe \"C:\\Program Files\\GAMS23.7\\trnsport_php.gms"))
echo'success';
else
echo 'no';
推荐答案
我发现了这个问题我不知道为什么但我应该去命令行并简单地调用 gams
I found the problem I don't know why but I should go to commandline and simply call the gams
echo exec('C:\WINDOWS\system32\cmd.exe');
echo exec('gams.exe trnsport_php.gms');
这篇关于从具有系统的应用程序执行 exe 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!