如何使php运行prolog程序,当我在命令行上使用但不与php一起使用时,该命令有效 [英] How to make php run a prolog program,The command works when i use on command line but not with php

查看:48
本文介绍了如何使php运行prolog程序,当我在命令行上使用但不与php一起使用时,该命令有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过php在swi prolog上运行程序。我在Windows上运行

I am trying to run a program on swi prolog through php. I am running on windows

我的命令如下

 $cmd = "C:\Program Files (x86)\pl\bin\swipl  -f test1.pl -g test " halt;

 exec( $cmd );

当我尝试运行php代码时什么也没有发生,它会等待一段时间并返回Windows上的命令提示符/ system32 / exe

nothing happens when i try to run my php code it waits for while and returns to command prompt on windows/system32/exe

,但是当我在cmd行上执行同一命令时,我得到了所需的输出

but when i execute the same command on cmd line i get the desired out put

C:\Program Files (x86)\pl\bin\swipl  -f test1.pl -g test " halt;

最近两天我一直在尝试,任何帮助将不胜感激

i had been trying it for last two days, any help will be highly appreciated

感谢为愿意思考并帮助我的所有人提供帮助

Thanks in advance for all people who will give it a thought and help me

推荐答案

尝试使用双反斜杠(并在其中包括停止双引号):

Try using double-backslashes (and including "halt" within the double-quotes):

$cmd = "C:\\Program Files (x86)\\pl\\bin\\swipl -f test1.pl -g test halt";

这篇关于如何使php运行prolog程序,当我在命令行上使用但不与php一起使用时,该命令有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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