---
title: "graphviz + php 画图"
author: "marx"
date: "2013-04-21T21:20:09Z"
tags: ["dot", "graphviz"]
categories: ["编程语言"]
slug: "graphviz-php"
draft: false
lastmod: "2013-04-21T21:20:09Z"
id: 1851115
url: "https://marx.iteye.com/blog/1851115"
---

header("Content-type:image/png;");

$content = "digraph call\_graph{

N1\[shape=polygon,sides=6,label=\\"A\\",width=1, fontsize=15,style=filled,fillcolor=red]; N2\[shape=polygon,sides=5,label=\\"b\\" ,width=1,fontsize=14 ,style=filled,fillcolor=yellow]; N3\[shape=polygon,sides=5,label=\\"c\\" ,width=1,fontsize=14 ,style=filled,fillcolor=yellow]; N4\[shape=polygon,sides=5,label=\\"d\\" ,width=1,fontsize=14 ,style=filled,fillcolor=yellow]; N1-&gt;N2\[arrowsize=2.0,label=\\"out\\",headlabel=\\"2\\",taillabel=\\"2\\"];

N2-&gt;N3\[arrowsize=2.0,label=\\"out\\",headlabel=\\"2\\",taillabel=\\"2\\"];

N3-&gt;N4\[arrowsize=2.0,label=\\"out\\",headlabel=\\"2\\",taillabel=\\"2\\"];

N4-&gt;N2\[arrowsize=2.0,label=\\"out\\",headlabel=\\"2\\",taillabel=\\"2\\"];

}";

 

passthru("echo \\"$content\\"|dot -Tpng");

 

![](http://dl.iteye.com/upload/attachment/0083/4639/9743a6df-0e39-38ae-b94e-c7e5d857f9da.jpg)