@include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pppswing
Forum Commoner
Posts: 33
Joined: Thu Jun 10, 2004 2:04 am
Location: Tallinn, Estonia

@include

Post by pppswing »

Hello,

1_ What is the difference between @include() and include() ?

2_ Is there a way to make an include of file relative to the current script that include it instead of the current directory ?

Thanks
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

1. @ supresses errors
2. Put your files to be includes in a directory, add that directory to your include_path. Then you can include any of the files in the directory you previously specified from anywhere (i.e any file in any directory) by just doing require_once 'foo.php' or include_once 'foo.php' ... as long as foo.php is in your newly created include directory.
pppswing
Forum Commoner
Posts: 33
Joined: Thu Jun 10, 2004 2:04 am
Location: Tallinn, Estonia

Post by pppswing »

Where should I include this directive ?
in any php file ?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

You can set it in your php.ini file, in a vhost directive in your httpd.conf, in a .htaccess file, use ini_set, or use set_include_path if you have PHP >= 4.3.0
Post Reply