downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

inclued 関数> <
Last updated: Fri, 13 Nov 2009

view this page in

inclued をアプリケーションに組み込む例

この例では、inclued を既存のアプリケーションに組み込んで結果を見る方法を説明します。

例1 inclued からのデータの取得

<?php
// inclued の情報を保存するファイル
$fp fopen('/tmp/wp.json''w');
if (
$fp) {
    
$clue inclued_get_data();
    if (
$clue) {
        
fwrite($fpjson_encode($clue));
    }
    
fclose($fp);
}
?>

データが取得できたら、それを何らかの形式で図にしてみたいと思われることでしょう。 inclued 拡張モジュールには gengraph.php という PHP ファイルが組み込まれています。 このファイルは、» graphviz ライブラリで使える dot ファイルを作成します。 しかし、これは必須ではありません。

例2 gengraph.php の使用例

この例は、inclued のデータを示す画像 inclued.png を作成します。

# まず dot ファイルを作成します
$ php graphviz.php -i /tmp/wp.json -o wp.dot

# そして画像を作成します
$ dot -Tpng -o inclued.png wp.dot



add a note add a note User Contributed Notes
inclued をアプリケーションに組み込む例
david at palepurple dot co dot uk
06-Mar-2009 11:23
The included 'gengraph.php' script expects to read serialized data; therefore a better usage example would be :

<?php
// Add this to the page you want to track includes on
if(is_writeable('/tmp/wp.xx')) {
    if(
function_exists('inclued_get_data')) {
       
$clue = inclued_get_data();
       
file_put_contents('/tmp/wp.xx', serialize($clue));
    }
}
?>

And to generate the human readable graph :

# First, create the dot file
$ php /path/to/inclued-src/gengraph.php -i /tmp/wp.xx -o wp.dot

# Next, create the image
$ dot -Tpng -o inclued.png wp.dot

inclued 関数> <
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites