Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php autoload classes

<?php
function loadModel($class) {
 $path = $DOCUMENT_ROOT . '/models/';
 require_once $path . $class .'.php';
}

function loadView($class) {
 $path = $DOCUMENT_ROOT . '/views/';
 require_once $path . $class .'.php';}
}

spl_autoload_register('loadModel');
spl_autoload_register('loadView');
Comment

php autoload classes

<?php
spl_autoload_register(function ($class_name) {
    include $class_name . '.php';
});

$obj  = new MyClass1();
$obj2 = new MyClass2(); 
?>
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress theme widgets 
Php :: simplexml_load_string alternative php 
Php :: explode php all values to int 
Php :: format a number with leading zeros in php 
Php :: laravel controller in details 
Php :: function () ?type{} in php 
Php :: can we create linked list in php 
Php :: pagination php mysql 
Php :: php check if a url exists 
Php :: use font awesome in laravel 8 
Php :: how to include pdf in php page using embed tag 
Php :: laravel break 
Php :: prevent SQL injection in PHP? 
Php :: laravel return response view 
Php :: php gethostname 
Php :: file exist php 
Php :: laravel validate date 
Php :: Catches the last error php 
Php :: laravel apiresource 
Php :: php connect strings 
Php :: yesterday php 
Php :: root composer.json requires php ^7.3 but your php version (8.0.3) does not satisfy that requirement. 
Php :: how to build laravel database 
Php :: laravel log reader 
Php :: php .= 
Php :: how to show image in laravel 
Php :: laravel custom validation message 
Php :: rename migration laravel 
Php :: php check if parameter exists in url 
Php :: function passing multiple arguments using 3 dots php 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =