怎样用php调用graphviz画拓扑图
1.安装graphviz
到http://www.graphviz.org/Download..php里下载对应的平台的安装包;
2.安装完毕后进行测试
echo“digraphG{Hello->World}”|dot-Tpng>hello.png
3.php调用graphviz
首先用程序生成/tmp/domain.txt,然后用dot命令生成图片
怎样用php调用graphviz画拓扑图
header("Expires:Mon,26Jul199705:00:00GMT");//Dateinthepast
header("Last-Modified:".gmdate("D,dMYH:i:s")."GMT");//alwaysmodified
header("Cache-Control:no-cache,must-revalidate");//HTTP/1.1
header("Pragma:no-cache");//HTTP/1.0
header("Content-type:image/gif");
$filename='/tmp/domain.txt';
$somecontent="digraphG{a->b->c->a}";
if(!$handle=fopen($filename,'w')){
echo"cannotopen$filename";
exit;
}
if(fwrite($handle,$somecontent)===FALSE){
echo"cannotwriteto$filename";
exit;
}
fclose($handle);
passthru("dot-Tpng$filename");
//passthru("cat$filename|dot-Tpng");
?>
上一篇:SQLServer变量赋值的方法