首页 文章

PHP致命错误:require()

提问于
浏览
0

我有一个网站,在我的本地主机上使用xampp完美,但是...我上传到几个免费网站托管(000webhost和hostinger),当我尝试打开它时,收到此消息:

警告:require(core / libs / smarty / Smarty.class.php):无法打开流:第7行/home/u327900732/public_html/www/index.php中没有此类文件或目录致命错误:require() :在第7行的/home/u327900732/public_html/www/index.php中打开所需的'core / libs / smarty / Smarty.class.php'(include_path =' . :/ opt / php-5.5 / pear')失败

这是代码:

<?php   

session_start();

$view = isset($_GET['view']) ? $_GET['view'] : 'index';

require_once('core/libs/smarty/Smarty.class.php');
require('core/models/class.Conexion.php');

if(file_exists('core/controllers/'.$view.'Controller.php')){
    include('core/controllers/'.$view.'Controller.php');
}else {
    include('core/controllers/errorcontroller.php');
}

?>

我检查了那个文件一百次,它就在那里 .

我发现并尝试了这个解决方案:

  • 更改要求包括:

警告:include(core / libs / smarty / Smarty.class.php):无法打开流:第7行/home/u327900732/public_html/www/index.php中没有此类文件或目录警告:include():无法在第7行的/home/u327900732/public_html/www/index.php中打开'core / libs / smarty / Smarty.class.php'以包含(include_path =' . :/ opt / php-5.5 / pear')致命错误:在第3行的/home/u327900732/public_html/www/core/controllers/indexController.php中找不到类'Smarty'

  • require(chdir(dirname( FILE )) . 833701);

警告:require(1core / libs / smarty / Smarty.class.php):无法打开流:第7行/home/u327900732/public_html/www/index.php中没有此类文件或目录致命错误:require() :在第7行的/home/u327900732/public_html/www/index.php中打开所需的'1core / libs / smarty / Smarty.class.php'(include_path =' . :/ opt / php-5.5 / pear')失败

  • 更改第7行
    require_once($ _ SERVER ['DOCUMENT_ROOT'] .'/core/libs/smarty/Smarty.class.php');

警告:require_once(/home/u327900732/public_html/core/libs/smarty/Smarty.class.php):无法打开流:/home/u327900732/public_html/www/index.php中没有这样的文件或目录7致命错误:require_once():在/ home中打开所需的'/home/u327900732/public_html/core/libs/smarty/Smarty.class.php'(include_path =' . :/ opt / php-5.5 / pear')失败第7行/u327900732/public_html/www/index.php

我尝试在路径中添加'./',但它仍然不起作用 . 我再说一遍,该网站在我的localhost中工作得很好 . 请帮忙!

1 回答

  • 0

    尝试使用完整的URL来测试您的网址 . 或者检查浏览器以检查文件是否存在 . 像这儿:

    http://host.com/core/libs/smarty/Smarty.class.php

    我认为它会显示错误,表明你的文件不存在 .

相关问题