PHP __autoload function

When PHP encounters a class that hasn’t been defined yet, you can use __autoload to automatically add them instead of including masses of included at the top of your files.

e.g.

function __autoload($class_name) {
  require_once $class_name . '.php';
}
Tags:

Leave a Reply

Your email address will not be published.