/home/name_a/folder/public_html/index.php脚本:
include_once('/home/name_b/folder/public_html/index.inc.php');
index.inc.php脚本:
define("ROOT", __DIR__ ."/");
$pages_dir = 'pages';
include ($page_dir.'/'.filename.php');
$pages = scandir($pages_dir, 0);
print_r($page);
我的问题是,包含文件工作正常(/home/name_b/folder/public_html/pages/filename.php),但scandir会查找/ home / name_a / folder / public_html / pages。有什么想法吗?
答案 0 :(得分:1)
尝试以这种方式定义pages_dir:
$pages_dir = dirname(__FILE__) . '/pages/';