我有一个文件functions.php。 在文件中的一些功能指向特定位置,如thisone:PHP路径问题
function returnFolders() {
$folders = array_filter(glob("images/*"), 'is_dir');
return $folders;
}
该函数返回图像/文件夹,其中的functions.php文件所在内的目录。
问题是,如果我从另一个文件夹中的脚本包含此function.php而不是function.php驻留在此函数将不会给出正确的结果。
这怎么解决,所以它会一直返回functions.php所在的文件夹?
路径是这样的:
common/functions.php
common/images/1
common/images/2
common/crons/im_including_functions.php
dir1/im_also_including_functions.php
d3/me_too.php
结构看起来像这样: 公共/ functions.php的 公共/图像/ 1 公共/图像/ 2 公共/ crons/im_including_functions.php DIR1/im_also_including_functions.php dir2/me_too_including_functions.php 那么这个工作呢? – 2013-02-26 18:27:08
这是工作,谢谢:) – 2013-02-26 19:53:54