0
餘米嘗試配置的類.. 這是我的init.php文件 的init.php致命錯誤:在PHP中找不到類Config?
<?php
session_start();
$GLOBALS['config'] = array(
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => 'rajaraman',
'db' => 'sms'
),
'remember' => array(
'cookie_name' => 'hash' ,
'cookie_expiry' => 604800
),
'session' => array(
'session_name' => 'user'
)
);
spl_autoload_register(function($class){
require_once 'classes/' .$class. '.php';
});
require_once 'functions/sanitize.php';
?>
的index.php
<?php
require_once 'core/init.php';
echo Config::get('mysql/host');
?>
的config.php
<?php
public class Config{
public static function get($path = null){
if($path){
$config = $GLOBALS['config'];
$path = explode('/',$path);
print_r($path);
}
}
}
當我試圖打印陣列它顯示我一些致命的錯誤,我dnt實際上是什麼問題,請任何人幫助我....
致命錯誤:類'Config'找不到C: \ XAMPP \ htdocs中\上線的學生管理系統\的index.php 4
謝謝你的工作 –
@RajaRamanTechWorld請標記答案是正確的:) – stepozer