簡體   English   中英

PHP不包括文件

[英]PHP not including file

我在PHP中調用帶有require的文件,但不會加載。

如果文件可能與htaccess重定向在一起,則該文件可能與此有關。

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

adminPanel.php的頂部:

<?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,但沒有運氣,並且由於require無法提取該文件,因此不會加載初始頁面的其余部分。

任何想法?

嘗試使用完整的絕對路徑。

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

如果那不起作用,那么您的路徑是錯誤的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM