利用PHP的Popen实现RRDTOOL作图的动态输出_PHP教程
error_reporting(E_ALL);
//作图命令,注意看 graph 后面加了一个连接符
$command = '/opt/rrdtool/bin/rrdtool graph - --start=-86400 --end=-300 --title=Test --height=400 --width=800 DEF:value1="/home/echo/workspace/misc/tianjin_dpool_web_21_traffic_in_22.rrd":traffic_in:AVERAGE AREA:value1#ff0000 2>&1';
//测试管道符
session_write_close();
//用管道的方式执行命令,并且接收错误输出
$handle = popen("$command 2>&1", 'r');
$read = '';
while (!feof($handle)) {
$read .= fgets($handle, 4096);
}
pclose($handle);
echo $read;
// Set the proper headers to allow caching
$this->request->headers['Content-Type'] = File::mime_by_ext('png');
$this->request->headers['Content-Length'] = strlen($read);
$this->request->headers['Last-Modified'] = date('r', time());
from:lonely blog
上一篇: 安装Oracle需要配置的系统内核参数
下一篇: 掘金万亿母婴市场,宝宝树价值在哪里?