PHP不包括文件


PHP not including file

我正在PHP中调用一个带有require的文件,但它不会加载。

该文件正在使用htaccess重定向,如果这可能与它有关的话。

include '/assets/header.php';
require '/assets/adminPanel.php'; //file that will not load

adminPanel.hp:顶部

<?php 
error_reporting(E_ALL);
$Hero_ = new Hero_;
$onMain = $Hero_->hero_checkMain($id);
$onSub = $Hero_->hero_checkSub($id, $article['cat']);
if(isset($_SESSION['logged'])) {
if($user_i['rank'] > 0) {
?>

我尝试过删除该文件顶部的PHP,但没有成功,由于无法获取文件,初始页面的其余部分将无法加载。

知道吗?

尝试使用完整的绝对路径。。

// Path to the current directory
$path = realpath(dirname(__FILE__));
include $path.'/assets/header.php';
require $path.'/assets/adminPanel.php'; //file that will not load

如果这不起作用,那么你的道路就错了。