【问题标题】:Problems while invoking swi-prolog from PHP从 PHP 调用 swi-prolog 时出现问题
【发布时间】:2015-04-20 11:01:25
【问题描述】:

我正在尝试从 PHP 执行一个 swi-prolog 文件,但是当我尝试运行此代码时,没有执行任何操作。这是我的代码:

<HTML>
<HEAD>
<TITLE>Calling SWI-Prolog from PHP (short)</TITLE>
</HEAD>
<body>
<H1>Calling SWI-Prolog from PHP (short)</H1>

<? 
  $cmd = "nice -n15 /C:/Program Files/swipl/bin/swipl-win.exe -f test.pl -g test,halt";
?>

<P>
<PRE>
<? 
  system( $cmd );
  echo "\n";

  $output = exec( $cmd );
  echo $output;
  echo "\n";

  exec( $cmd, $output );
  print_r( $output );
  echo "\n";

  $output = shell_exec( $cmd );
  echo $output;
  echo "\n";
?> 
</PRE>
</P>

</body>
</HTML>

当我从我的服务器运行 php 文件时,它只显示字符串 Calling SWI-Prolog from PHP (short)

【问题讨论】:

    标签: php prolog swi-prolog


    【解决方案1】:

    激活错误报告,您可能会看到一些信息显示出了什么问题。

    在文件开头添加:

    <?php
      ini_set("display_errors", "1");
      error_reporting(E_ALL);
    ?>
    

    完成调试后,您应该删除这些行。您永远不应该在生产环境中打印错误输出。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-05
      相关资源
      最近更新 更多