我有一個文件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