时间:2021-07-01 10:21:17 帮助过:13人阅读
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
http://www.bkjia.com/PHPjc/478707.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478707.htmlTechArticle近看了一下RRDTOOL如何作图,语法确实比较繁琐,但不是太难。命令行下执行的时候,每次都需要输出成为一个文件。我们希望做一个应用,...