php - spl_autoload_register issue -


i don't why error

fatal error: class 'imagejpg' not found 

here code use

spl_autoload_register(function($class) {     if(file_exists($class))     {         include $class.'.php';     } });  $n = new imagejpg(); 

file imagejpg.php in same dir code above.

here content of imagejpg.php

<?php class imagejpg {     public function __construct()     {         echo 'image jpg called';     } } 

is there class named imagejpg in imagejpg.php file? , file exist? try this:

spl_autoload_register(function($class) {     if(file_exists($class.'.php'))     {         include $class.'.php';          if (!class_exists($class))         {             die('required class not present');         }     }     else     {         die('file not found');     } }); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -