PHP 不包括文件
PHP not including file
我在 PHP 中调用需要一个文件,但它不会加载。
正在使用 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
如果这不起作用,那么你的路径是错误的。
我在 PHP 中调用需要一个文件,但它不会加载。
正在使用 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
如果这不起作用,那么你的路径是错误的。