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

search for in the

Fonctions inclued> <Exemples
Last updated: Fri, 14 Aug 2009

view this page in

Exemple qui implémente inclued dans une application

Cet exemple montre comment implémenter inclued dans une explication existante, et afficher les résultats.

Exemple #1 Lecture des informations depuis inclued

<?php
// Fichier de stockage des informations d'inclusion
$fp fopen('/tmp/wp.json''w');
if (
$fp) {
    
$clue inclued_get_data();
    if (
$clue) {
        
fwrite($fpjson_encode($clue));
    }
    
fclose($fp);
}
?>

Maintenant que nous avons des données, il est temps de prendre du recul et d'avoir un graphique. L'extension inclued inclut un fichier PHP appelé gengraph.php qui crée un fichier DOT, qui peut être passé à la bibliothèque » graphviz. Cependant, cette approche n'est pas obligatoire.

Exemple #2 Exemple d'utilisation de gengraph.php

Cet exemple crée une image appelée inclued.png qui montre les fichiers inclus.

# 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



add a note add a note User Contributed Notes
Exemple qui implémente inclued dans une application
david at palepurple dot co dot uk
06-Mar-2009 02: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

Fonctions inclued> <Exemples
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites