我得到了一些麻煩,我做了一個動態的,需要功能,我用它在兩個PHP文件,在同一目錄下,名爲database_controller.php和login.php中。事實是,當我在登錄文件中調用require函數時,它在一些測試中說我存在該文件但在此測試之後的要求沒有接受該文件。 而在我的文件database_controller當我調用需要的功能它的工作原理沒有問題所需的文件沒有工作,但所需的文件存在
的登錄文件測試的要求
require "./Utils/require.php";
if (file_exists(requires(intval($rows["role"])))) {
echo "exist";
require requires(intval($rows["role"]));
echo "loaded";
//doing something with the dynamic require
}
else {
echo requires(intval($rows["role"]));
exit;
}
當我跑我得到了錯誤500內部服務器錯誤和響應登錄的登錄文件僅僅是「存在」
這裏的./Utils/require.php
/**
* @function requires
* @param $userType
* @return int|string
*/
function requires($userType) {
switch($userType) {
case 0:
if (file_exists("Path to required file for user type 0")) {
return "Path to required file for user type 0";
}
else
return 0;
case 1:
if (file_exists("Path to required file for user type 1")) {
return "Path to required file for user type 1";
}
else
return 0;
case 2:
if (file_exists("Path to required file for user type 2")) {
return "Path to required file for user type 2";
}
else
return 0;
}
}
個內容和這裏的什麼我具有相同功能的
require_once "./Utils/require.php";
require_once "./error.php";
/*
* Post request method for packers
*/
if ($UserType == 0) {
if (requires($UserType)) {
require requires($UserType);
//doing something with the dynamic required file
}
}
/*
* Post request method for supervisors
*/
elseif ($UserType == 1) {
if (requires($UserType)) {
require requires($UserType);
//doing something with the dynamic required file
}
}
/*
* Post request method for admins
*/
elseif ($UserType == 2) {
if (requires($UserType)) {
require requires($UserType);
//doing something with the dynamic required file
}
}
在這裏,我沒有在500內部服務器錯誤的database_controller做,我有200行,我有具體的形式顯示
這裏之間的數據庫是請求頭: Host:easyweb.neyconsulting.ch User-Agent:Mozilla/5.0(X11; Linux x86_64; rv:38.0)Gecko/20100101 Firefox/38.0 Iceweasel/38.5.0 Accept:text/html,*/*; q = 0.01 Accept-Language:zh-cn,en; q = 0.5 Accept-Encoding:gzip,deflate DNT:1 Content-Type:application/x-www-form-urlencoded;字符集= UTF-8 X-請求-隨着:XMLHttpRequest的 的Referer:http://easyweb.neyconsulting.ch/ 的Content-Length:46 連接:保持活着 附註:無緩存 緩存控制:無-cache – FredS104
和響應標頭: 連接:關閉 內容長度:5 內容類型:文本/ HTML;字符集= UTF-8 日期:星期三,2016年1月13日9點35分45秒GMT 服務器:Apache/2.4.10(Debian的) – FredS104
有分號';'在一行缺少'回聲 「加載」'。另外我需要php的錯誤日誌。 – AnkiiG