Fixes for load libraries using php autoload
This commit is contained in:
parent
0b21909a78
commit
47c7003e3b
4 changed files with 82 additions and 9 deletions
26
index.php
26
index.php
|
|
@ -7,6 +7,16 @@ ob_start();
|
|||
include('libraries/Utils.php');
|
||||
include('libraries/Routes.php');
|
||||
|
||||
if(is_file(__DIR__.'/vendor/autoload.php')) {
|
||||
|
||||
include(__DIR__.'/vendor/autoload.php');
|
||||
|
||||
}
|
||||
|
||||
//ob_start();
|
||||
|
||||
Utils::load_config('config');
|
||||
|
||||
/*spl_autoload_register(function ($class_name) {
|
||||
|
||||
//include($nombre_clase . '.php';
|
||||
|
|
@ -23,15 +33,19 @@ include('libraries/Routes.php');
|
|||
|
||||
});*/
|
||||
|
||||
if(is_file(__DIR__.'/vendor/autoload.php')) {
|
||||
spl_autoload_register(function($class_name) {
|
||||
|
||||
include(__DIR__.'/vendor/autoload.php');
|
||||
//Simple autoload for modules, first element is module, second element is the file to load.
|
||||
|
||||
$arr_library=explode('\\', $class_name);
|
||||
|
||||
$module=strtolower($arr_library[0]);
|
||||
$library=strtolower($arr_library[1]);
|
||||
|
||||
include('modules/'.$module.'/libraries/'.$library.'.php');
|
||||
|
||||
}
|
||||
|
||||
//ob_start();
|
||||
|
||||
Utils::load_config('config');
|
||||
});
|
||||
|
||||
if(!PhangoApp\PhaRouter\Config::$on_other) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue