我目前正在忙於我的index.php
以包括通過$_GET
請求的文件。 唯一的問題是它總是返回admin
,並且從不返回$_GET
變量中聲明的值。
所有文件都位於用作子域的目錄中。
Warning: include(pages/admin.php): failed to open stream: No such file or directory in /home/tjattern/domains/*censored*/public_html/admin/index.php on line 20
我請求http://admin.*censored*.nl/index.php?page=dashboard
index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// include required files
require_once('core/config.php');
require_once('template/tpl_top.php');
if(isset($_COOKIE['as']))
{
if(isset($_GET['page']))
{
$file = "pages/".$_GET['page'].".php";
if(file_exists($file))
{
include($file); // actual line 20
}
else
{
echo 'This page could not be found';
}
}
else
{
include('pages/dashboard.php');
}
}
else
{
include('pages/login.php');
}
require_once('template/tpl_bot.php');
?>
是index.php的全部內容嗎?如果是這樣,錯誤出現在另一個文件中。您應該在嘗試包含之前檢查文件是否存在。 –
你要求的URL是什麼?你是否拋出了$ _GET後續代碼var_dump($ _ GET);?是你的.htaccess重寫你的網址?你也可以把include包裝在is_file中('pages /'.$_ GET''page']。'。php');實際檢查文件是否存在。 – Springie
更新了代碼,插入完整的index.php - 主目錄中有一個htaccess,是否也會影響子目錄?當我轉儲var時,它也給了我管理員。 –