SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | // ./fichier_1.php | |
| 4 | define('CLASS_DIR', 'class/');
| |
| 5 | set_include_path(".".PATH_SEPARATOR.CLASS_DIR);
| |
| 6 | ||
| 7 | spl_autoload_extensions('.class.php');
| |
| 8 | spl_autoload_register(); | |
| 9 | ||
| 10 | use mon\outil\Test; | |
| 11 | ||
| 12 | - | $test = new Test(); |
| 12 | + | $test = new Test();// Output: "Tralala !" |
| 13 | - | $test->fonctionne(); |
| 13 | + | |
| 14 | //./class/mon/outil/Test.class.php | |
| 15 | namespace mon\outil; | |
| 16 | class Test | |
| 17 | {
| |
| 18 | public function __construct() | |
| 19 | {
| |
| 20 | echo "Tralala !"; | |
| 21 | } | |
| 22 | } | |
| 23 | ||
| 24 | ||
| 25 | ?> |