📄 inclued.examples.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Examples</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="inclued.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.inclued.html">inclued Functions</a></div> <div class="up"><a href="book.inclued.html">inclued</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <div id="inclued.examples-implementation" class="section"> <h2 class="title">Example that implements inclued into an application</h2> <p class="para"> This example demonstrates the process of implementing inclued into an existing application, and viewing the results. </p> <p class="para"> <div class="example"> <p><b>Example #1 Getting the data from inclued</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// File to store the inclued information<br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'/tmp/wp.json'</span><span style="color: #007700">, </span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$fp</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">$clue </span><span style="color: #007700">= </span><span style="color: #0000BB">inclued_get_data</span><span style="color: #007700">();<br /> if (</span><span style="color: #0000BB">$clue</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #0000BB">json_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$clue</span><span style="color: #007700">));<br /> }<br /> </span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> <p class="para"> Now that some data exists, it's time to make sense of it in the form of a graph. The inclued extension includes a PHP file named <var class="filename">gengraph.php</var> that creates a dot file that requires the <a href="http://www.graphviz.org/" class="link external">» graphviz</a> library. However, this form is not required. </p> <p class="para"> <div class="example"> <p><b>Example #2 Example use of gengraph.php</b></p> <div class="example-contents"><p> This example creates an image named inclued.png that shows the inclued data. </p></div> <div class="example-contents"><div class="cdata"><pre># First, create the dot file$ php graphviz.php -i /tmp/wp.json -o wp.dot# Next, create the image$ dot -Tpng -o inclued.png wp.dot</pre></div> </div> </div> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="inclued.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.inclued.html">inclued Functions</a></div> <div class="up"><a href="book.inclued.html">inclued</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -