获得内容,然后运行你的脚本,然后获取返回内容. $cmd = " test.sh " . $_POST['ip'];
if ($result = popen($cmd, "r"))
{
while (!feof($result))
{
$line = fgets($result, 1024);
$strContent .= $line;
//if ($pre) $line = replaceEntities($line, $this->repConfig);
}
pclose($result);
}
//显示脚本执行结果
echo $strContent;
if ($result = popen($cmd, "r"))
{
while (!feof($result))
{
$line = fgets($result, 1024);
$strContent .= $line;
//if ($pre) $line = replaceEntities($line, $this->repConfig);
}
pclose($result);
}
//显示脚本执行结果
echo $strContent;
解决方案 »
- help 错误信息是utf8 to ucs2 conversion failed on this string
- PHP--获取表单问题!
- 求PHP网站查看源码办法~
- 怎么捕捉exception,如何处理多线程问题
- 大家有这本书的源文件吗?求一份!!
- Dreamweaver + PHP基础安装、教程.急求!!!!!!!!!!!!!!!!!!!
- 菜鸟问题:二维数组用法
- smarty模版应用,急救!!!!!!!!!!
- 多谢,请高手tell me,怎么才能在windows下,配置一个 PHP论坛???
- 验证码问题~~急~~~
- 静态页 提交表单 到 *.php页面 发送邮件
- 一个关于字符串奇怪的问题,求解~~
谢谢Jakey兄,俺对php一窍不通,现在想通过php做一个web工具供大家使用。请问文本框和按钮这些地方怎么写?怎么跟上面的内容连接起来使用。再次感谢!
<form name="form1" method="post" action="xxx.php">
<input type='text' name='ip' value=""/>
<input name="submit" type="submit" value="提交"/>
</form> xxx.php<?php
if($_POST['submit'] != "")
{
$cmd = " test.sh " . $_POST['ip'];
if ($result = popen($cmd, "r"))
{
while (!feof($result))
{
$line = fgets($result, 1024);
$strContent .= $line;
//if ($pre) $line = replaceEntities($line, $this->repConfig);
}
pclose($result);
}
//显示脚本执行结果
echo $strContent;
}