问题描述
我正在努力让popen在Windows上工作。
这是我正在努力工作的简化示例:
我有一个hw.c程序如下:
#include< stdio.h>
main()
{
printf(Hello World!\ n);
}
和这里是''popentest.php''代码:
popen test ...
<?php
$ fp = popen(''C:\\home \\bin\\hw.exe'',''r'');
$ data = fread( $ fp,1024);
pclose($ fp);
echo $ data;
?>
当我从命令提示符运行它时它起作用:
C:\ Inetpub \wwwroot \ php> php popentest.php
popen测试...
Hello World!
我在网络浏览器中获得的是:
popen测试...
我缺少什么?
谢谢
Daniel Klein
I''m trying to get popen to work on Windows.
Here''s a simplified example of what I''m trying to get working:
I have a hw.c program as follows:
#include <stdio.h>
main()
{
printf ("Hello World!\n");
}
And here''s the ''popentest.php'' code:
popen test...
<?php
$fp = popen(''C:\\home\\bin\\hw.exe'', ''r'');
$data = fread($fp, 1024);
pclose($fp);
echo $data;
?>
It works when I run this from a command prompt:
C:\Inetpub\wwwroot\php>php popentest.php
popen test...
Hello World!
All I get in a web browser is:
popen test...
What am I missing?
Thanks
Daniel Klein
推荐答案
这篇关于在Windows上的popen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!