作者alpe (薛丁格的猫)
看板PHP
标题Re: [请益] 在php网页配合linux指令建立文字档
时间Fri Oct 27 01:16:31 2006
※ 引述《s31039 (Brice)》之铭言:
: : $temp=passthru("sudo /sbin/iptables -t nat -L -n");
: : 结果a.txt档内却没有出现任何文字
: : 而且passthru若改为exec函数就有文字出现 不过只有最後一列而已
void passthru ( string command [, int &return_var] )
void 的意思是... 不会有东西了
所以你 $temp = passthru...
怎麽可能有东西呢!?
在说 :
http://tw.php.net/passthru
The passthru() function is similar to the exec() function
in that it executes a command. This function should be used
in place of exec() or system() when the output from the Unix
command is binary data
which needs to be passed
directly back to the browser.
=.= 所以请改用 exec() or system()
: : 或是还有其他方法比较容易呢?
: : thanks
: 改成 passthru("sudo /sbin/iptables -t nat -L -n",$temp);
: 结果也是一样
--
你可以攀爬圣母峰一千次,不过他永远也不会知道你的名字,
认清自己的无名与恐怖的後果,是登山者谦卑的秘诀、攀岩者应有的自觉
David Breashea
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 221.169.25.33