Posted By

iTony on 07/24/09


Tagged

php autoload classes SPL


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


SPL_autoload example script


 / Published in: PHP
 

URL: http://www.brandonsavage.net/making-life-better-with-the-spl-autoloader/

check out why the getincludepath() was appended to the new path.

  1. <?php
  2.  
  3. set_include_path(realpath('/path/to/lib') . PATH_SEPARATOR . get_include_path());
  4.  
  5. function autoload($className)
  6. {
  7. require($className . '.php');
  8. }
  9.  
  10. spl_autoload_register('autoload');
  11.  
  12. $Database = new Database();
  13.  
  14. ?>

Report this snippet  

You need to login to post a comment.