2015-01-10 65 views
-1

我的項目是在Web服務器上運行,即Ecommerce Project ,但它不是在我的本地服務器上運行,並給予一個錯誤即項目現場Web服務器上而不是在本地服務器上運行

Warning: require_once(Core.php): failed to open stream: No such file or directory in C:\xampp\htdocs\shop\inc\autoload.php on line 7 
Fatal error: require_once(): Failed opening required 'Core.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\shop\inc\autoload.php on line 7 

這裏是我的

的index.php

<?php 
require_once('inc/autoload.php'); 
$core = new Core(); 
$core->run(); 
?> 

core.php中

<?php 
class Core { 

    public function run() { 
     ob_start(); 
     require_once(Url::getPage()); 
     ob_get_flush(); 
    } 

} 

autoload.php

<?php 
require_once('config.php'); 

function __autoload($class_name) { 
    $class = explode("_", $class_name); 
    $path = implode("/", $class).".php"; 
    require_once($path); 
} 

config.php 
<?php 
if(!isset($_SESSION)) { 
    session_start(); 
} 

// site domain name with http 
defined("SITE_URL") 
    || define("SITE_URL", "http://".$_SERVER['SERVER_NAME']); 

// directory separator 
defined("DS") 
    || define("DS", DIRECTORY_SEPARATOR); 

// root path 
defined("ROOT_PATH") 
    || define("ROOT_PATH", realpath(dirname(__FILE__) . DS."..".DS)); 

// classes folder 
defined("CLASSES_DIR") 
    || define("CLASSES_DIR", "classes"); 

// pages directory 
defined("PAGES_DIR") 
    || define("PAGES_DIR", "pages"); 

// modules folder 
defined("MOD_DIR") 
    || define("MOD_DIR", "mod"); 

// inc folder 
defined("INC_DIR") 
    || define("INC_DIR", "inc"); 

// templates folder 
defined("TEMPLATE_DIR") 
    || define("TEMPLATE_DIR", "template"); 

// emails path 
defined("EMAILS_PATH") 
    || define("EMAILS_PATH", ROOT_PATH.DS."emails"); 

// catalogue images path 
defined("CATALOGUE_PATH") 
    || define("CATALOGUE_PATH", ROOT_PATH.DS."media".DS."catalogue"); 

// add all above directories to the include path 
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(ROOT_PATH.DS.CLASSES_DIR), 
    realpath(ROOT_PATH.DS.PAGES_DIR), 
    realpath(ROOT_PATH.DS.MOD_DIR), 
    realpath(ROOT_PATH.DS.INC_DIR), 
    realpath(ROOT_PATH.DS.TEMPLATE_DIR), 
    get_include_path() 
))); 
+0

你實際讀取錯誤消息? 「沒有這樣的文件或目錄」對你來說意味着什麼? –

+0

但它運行在活動服務器,但每當我嘗試它在本地服務器上顯示此錯誤 – Sandy

回答

0

你似乎缺少PEAR。已經有一段時間了,但不是在PHP中的單獨模塊?

0

更改這裏的路徑...

require_once('config.php'); 
相關問題