2010-07-27 52 views
0

是否有可能让我的类文件已经包含在文件夹的所有文件中?已包含类

回答

1

还有auto_prepend_file配置选项
所以,你可以添加一个。 htaccess文件(如果你运行PHP作为Apache模块),该文件夹与以下行:

php_value auto_prepend_file /path/to/that/file 
4

,还可以自动在前面加上使用auto_prepend_file文件 - 设置php.ini中的路径,httpd.conf中或.htaccess文件:

Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require() function, so include_path is used. 
0

除了使用已经提到autoloading of classes你也可以指定一个.htaccess文件与auto_prepend_file的文件

php_value auto_prepend_file foo.php 

有了这个,只要在该目录中的PHP文件或子目录请求foo.php加载文件:之前被加载。