【问题标题】:how to send info from php to c++ using exec?如何使用 exec 将信息从 php 发送到 c++?
【发布时间】:2013-12-04 10:25:19
【问题描述】:

我需要使用exec 将信息从 php 发送到 c++,但我不能也不知道为什么这不起作用 我也用过escapeshellcmd(),但没有任何改变

<?php
$a=2; // here 1st value
$b=3; // here 2nd value
exec("project $a $b", $out); // here $a and $b should send the info to project but it's the problem
print_r($out); // here i use print_r to general use as some time the info be as array and echo won't print it
?>

我看到了结果

Array ( [0] => -858993460-858993460 )
-858993460

int类型的默认值

【问题讨论】:

  • is 项目与 php 根目录的路径相同,例如如果您的文件位于 /var/www/html 中,则项目也应该位于同一路径中,直到项目路径可全局访问
  • 您确定这不仅仅是project 可执行文件的输出吗?
  • 检查您的 C 程序是否可以由您的 apache 用户运行?
  • 我确信 100% 程序运行良好,如果获取值将打印出来

标签: php c++ exec


【解决方案1】:

也许这对你有用:

exec("project.exe {$a} {$b}", $out); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 2014-11-16
    • 1970-01-01
    • 2012-06-12
    • 1970-01-01
    • 2013-05-31
    • 1970-01-01
    相关资源
    最近更新 更多