lundi 23 avril 2018

Classes Autoloader php error

config.php

require_once 'classes/Autoloader.php';

classes/Autoloader.php

class Autoloader {
    public static function loader($className) {
        $filename = 'classes/' . $className . ".php";
        print_r($filename);
        if (file_exists($filename)) {
            include $filename;
            if (class_exists($className)) {
                return TRUE;
            }
        }
        return FALSE;
    }
}
spl_autoload_register('Autoloader::loader');

post_hanlder.php

require_once 'config.php';

if(isset($_POST['submit_login'])){

    Login::login($_POST['benutzername'], $_POST['passwort']);
}

Error: Fatal error: Uncaught Error: Class 'Login' not found in C:\xampp\htdocs\nc-admin\post_handler.php:11 Stack trace: #0 {main} thrown in C:\xampp\htdocs\nc-admin\post_handler.php on line 11

Windows 10




Aucun commentaire:

Enregistrer un commentaire