简体   繁体   中英

PHP not including file

I'm calling for a file with require in PHP, but it will not load.

The file is being redirected with htaccess, if that may have anything to do with it.

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

Top of 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) {
?>

I've tried deleting the PHP at the top of that file with no luck, and the rest of the initial page will not load on account of require not being able to fetch the file.

Any idea?

Try using the full absolute path..

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

If that doesn't work then your path is wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM