PHP Classes
elePHPant
Icontem

File: autoload.php

Recommend this page to a friend!
  Classes of Jericko Tejido  >  basset-ir  >  autoload.php  >  Download  
File: autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: basset-ir
Retrieve, transform and process text documents
Author: By
Last change:
Date: 6 months ago
Size: 599 bytes
 

Contents

Class file image Download
<?php
spl_autoload_register
(function ($className) {
   
$className = ltrim($className,'\\');
   
$fileName = __DIR__.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR;
   
$namespace = '';
   
$lastNsPos = strrpos($className,'\\');
    if (
$lastNsPos!==false) {
       
$namespace = substr($className,0,$lastNsPos);
       
$className = substr($className,$lastNsPos+1);
       
$fileName .= str_replace('\\',DIRECTORY_SEPARATOR,$namespace).DIRECTORY_SEPARATOR;
    }
   
$fileName .= str_replace('_',DIRECTORY_SEPARATOR,$className).'.php';
    if (
file_exists($fileName))
        require(
$fileName);
});