Let's say you have the following file structure:
Code:
php_library
db.php
www
index.php
In your index.php file, you would just use "include" as you normally would:
PHP Code:
include '../php_library/db.php';
Just because the user can't access the folder, doesn't mean PHP can't see it.
If you wanted, you could use an absolute path, instead:
PHP Code:
include 'full/absolute/path/to/php_library/db.php';
And if you're not sure of the absolute path, you can use the __FILE__ magic constant:
PHP Code:
echo __FILE__; // echos the full path and filename of the current file
Bookmarks