Page 1 of 1

@include

Posted: Thu Jun 10, 2004 2:04 am
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

Posted: Thu Jun 10, 2004 2:21 am
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.

Posted: Thu Jun 10, 2004 2:26 am
by pppswing
Where should I include this directive ?
in any php file ?

Posted: Thu Jun 10, 2004 2:31 am
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