I use this code to load classes
function __autoload($className)
{
$files = dirname(__FILE__).'/public/class/'.$className.'.php';
if(file_exists($files))
{
include_once($files);
}
}
does anyone know how to retrieve the function automatically, too? Thank you.
Autoloader function registered
spl_autoload_register()can be used to load classes, but not functions. Wrap your functions in class or classes to utilize autoloading, i.e.then call it static way:
and you can have it autoloaded when needed. See more infromation on autoloading in PHP manual.