我有这个脚本将图像输出到命令行,如果我将其重定向到file.png,我可以正确地看到图形,但如果我尝试从浏览器中做同样的事情,我无法动态地看到它.
我试图将脚本分成两部分,但是不起作用.
1 - >生成图2 - >从这一个调用第一个脚本并将所有脚本保存在变量中.
剧本:
<?php
header("Content-Type: image/png");
header("Content-Transfer-Encoding: binary");
ob_flush();
require_once ('/opt/rMON/config.php');
//if(isset($_GET['id'])){
// $id = trim($_GET['id']);
//} else {
// die("El id?");
//}
//DEBUG ID
$id=1;
$result = ***MYSQL QUERY***
$ip = long2ip($result['ip']);
$interface = $result['interface'];
$counter = $result['counter'];
$unix_name = $result['unix_name'];
$community = $result['community'];
$version = $result['version'];
$port = $result['port'];
$rrd_file = __RRD_ROOT__.$unix_name.".rrd";
$graph_name = $result['name'];
$host_ip = long2ip($result['ip']);
$iface_name = $result['iface_name'];
$fecha = date("y-m-d h:i:s");
$start = "3600";
$tiempo = "1 Hora";
create_graph($start, …
Run Code Online (Sandbox Code Playgroud)