문제

/home/name_a/folder/public_html/index.php script:

include_once('/home/name_b/folder/public_html/index.inc.php');

index.inc.php script:

define("ROOT", __DIR__ ."/");
$pages_dir = 'pages';
include ($page_dir.'/'.filename.php');
$pages = scandir($pages_dir, 0);
print_r($page);

My question is, the include file works fine (/home/name_b/folder/public_html/pages/filename.php) but the scandir looks for /home/name_a/folder/public_html/pages instead. Any idea?

도움이 되었습니까?

해결책

Try to define pages_dir this way:

$pages_dir = dirname(__FILE__) . '/pages/';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top