autoload php multiple spl_autoload_register
<?php
/**
*
* @param string $className Class or Interface name automatically
* passed to this function by the PHP Interpreter
*/
function autoLoader($className){
//Directories added here must be relative to the script going to use this file
$directories = array(
'',
'classes/'
);
//Add your file naming formats here
$fileNameFormats = array(
'%s.php',
'%s.class.php',
'class.%s.php',
'%s.inc.php'
);
// this is to take care of the PEAR style of naming classes
$path = str_ireplace('_', '/', $className);
if(@include_once $path.'.php'){
return;
}
foreach($directories as $directory){
foreach($fileNameFormats as $fileNameFormat){
$path = $directory.sprintf($fileNameFormat, $className);
if(file_exists($path)){
include_once $path;
return;
}
}
}
}
spl_autoload_register('autoLoader');
?>
Also in PHP:
- exception php
- blade if
- create a new laravel 8 project
- can we use a header function to redirect the user to another page
- douzo definition
- cache clear command in larvel
- date format php example
- check php variable type
- convert image path to base64 php
- file could not be downloaded: Unable to find the wrap per "https" - did you forget to enable it when you configured PHP? failed to open stream: No such file or directory
- create new seeder laravel
- fetch email from url contact form 7
- PHP string mask day-year
- date increase 1 day
- can we seed test database in laravel with seeder?
- contains php
- convert day to timestamp php
- ensure a header is included with request laravel
- codingneter in insert data and get id
- check backend post type
- codeigniter
- cache;clear laravel
- c date format php
- Allowed memory size of 134217728 bytes exhausted (tried to allocate 157 bytes) in C:\wamp64\scripts\refresh.php on line 2263