0

/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。任何想法?

4

1 回答 1

1

尝试以这种方式定义 pages_dir:

$pages_dir = dirname(__FILE__) . '/pages/';
于 2013-06-18T18:20:33.437 回答