//Recherche du niveau d'arborescence - Retourne "./" ou "./../" le nombre de fois nécessaire //Le fichier "ici_racine.php" doit exister à la racine du site function ou_est_on() { for($i=1,$dossier='./';$i<=5 && !file_exists($dossier.'ici_racine.php');$i++,$dossier.='../') if ($i==5) { echo "Localisation impossible"; return false; } return $dossier; }Et, on appelle la fonction quand on est « paumé » et qu'on veut inclure, par exemple, un fichier racine/dossier1/dossier2/inc/mon_include.php :
include(ou_est_on().'dossier1/dossier2/inc/mon_include.php');ou alors on peut, pour savoir quoi mettre en dur, faire :
echo "On est à :".ou_est_on().":";
<?php echo "<p>Fichier inc/dateinfo.php</p>\n"; ?>Dans un autre fichier mon_site/test/essais_include.php j'ai mis
<?php include('../inc/dateinfo.php'); ?>
http://mon_site/test/essais_include.phpet j'obtiens bien : Fichier inc/dateinfo.php
disable_functions = glob, filter_list, chown, chmod, get_current_user, php_uname, putenv, set_time_limit, getmyuid, getmypid, dl, ini_alter, ini_restore, ini_set, exec, passthru, system, popen, pclose, leak, mysql_list_dbs, listen, chgrp, disk_total_space, disk_free_space, rmdir, tmpfile, link, shell_exec, proc_open, chroot, openlog, closelog, syslog, flock, socket_create_listen, socket_accept, socket_listen, sleep, umask, set_include_path, restore_include_path, symlink, imagerotate
ALTER TABLE `ma_table` CONVERT TO CHARSET utf8 COLLATE utf8_general_ci;