Expected (/application/models/MySQLiConnection.php does NOT exist):
Code: Select all
function __autoload($class) {
if (!include('/application/models/' . $class . '.php')) {
throw new Exception('Unable to call ' . $class);
}
}
try {
$one = new MySQLiConnection();
}
catch (Exception $e) {
echo $e->getMessage();
}
// Outputs: "Unable to call MySQLiConnection."
Code: Select all
function __autoload($class) {
if (!include('/application/models/' . $class . '.php')) {
throw new Exception('Unable to call ' . $class);
}
}
try {
$one = MySQLiConnection::SetConnection();
}
catch (Exception $e) {
echo $e->getMessage();
}
// Outputs: "Fatal error: Class 'MySQLiConnection' not found in C:\Users\Michael\Websites\index.php on line 12."