Hacking Include Path

This is just another trick for easier way to include all your PHP code. Try to hack the include_path configuration. This is how I used to do it:

$separator = PHP_OS == "WINNT" ? ";" : ":";
ini_set("include_path", ini_get("include_path") . "$separator./lib1/$separator./lib2");

The code above will add directory ./lib1 and ./lib2 to the PHP search path.

2 komentar

  1. isdah junker ngalam bilang:

    nyoba’ aaaaah… weh nyoba ndek server “iku” oleh ta?

    November 2nd, 2006 at 21:23
  2. ferdhie bilang:

    why not, this code will make your life easier,

    include your library directory into the include_path and just use it, ex:

    require(’mylibrary.php’);

    as simple as that

    November 3rd, 2006 at 09:15

Tinggalkan Komentar





*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word