PHP Classes
elePHPant
Icontem

File: includes/autoload.php

Recommend this page to a friend!
  Classes of Marcel Kohls  >  Very Simple API  >  includes/autoload.php  >  Download  
File: includes/autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Very Simple API
Implement REST APIs using service classes
Author: By
Last change:
Date: 4 months ago
Size: 465 bytes
 

Contents

Class file image Download
<?php
   
function __autoload($classname) {
     
$classname = ltrim($classname, '\\');
     
$filename = '';
     
$namespace = '';
      if (
$lastnspos = strripos($classname, '\\')) {
       
$namespace = substr($classname, 0, $lastnspos);
       
$classname = substr($classname, $lastnspos + 1);
       
$filename = str_replace('\\', '/', $namespace) . '/';
      }
     
$filename .= str_replace('_', '/', $classname) . '.php';
      require
$filename;
    }