【发布时间】: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% 程序运行良好,如果获取值将打印出来