【发布时间】:2015-10-18 05:00:59
【问题描述】:
似乎在我的服务器上popen() 根本不起作用。我通过浏览器访问test.php,文件postt1.php 和postt2.php 没有被执行。 article1.txt 和 article2.txt 文件未写入。所有文件都在同一个目录中。
可能是什么问题?
在文件test.php我有:
<?php
$pipe1 = popen('postt1.php', 'w');
$pipe2 = popen('postt2.php', 'w');
pclose($pipe1);
pclose($pipe2);
echo "end";
?>
内部文件postt1.php我有:
<?php
$tosave = "Hello there";
$file = fopen("article1.txt","w");
fwrite($file,$tosave);
fclose($file);
echo $tosave;
echo "<br>done";
?>
在postt2.php 中,除了写入文件article2.txt 之外,我有同样的事情。
【问题讨论】:
-
popen 需要一个命令作为第一个参数,你只是传递
postt1.php,我会说类似php postt1.php。或者如果你想执行那些(postt1 & postt2)文件,请使用include。 -
您确定吗 - 此页面上的 popen 中没有其他参数 - stackoverflow.com/questions/70855/…