Skip to content

Commit 3689729

Browse files
committed
OOP
1 parent 6f9190b commit 3689729

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bootstrap/Autoload.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace bootstrap;
3+
4+
class Autoload
5+
{
6+
public function run($className)
7+
{
8+
spl_autoload_register( function( $class_name ) {
9+
/**
10+
* Note that actual usage may require some string operations to specify the filename
11+
*/
12+
$file_name = $class_name . '.php';
13+
if( file_exists( $file_name ) ) {
14+
require $file_name;
15+
}
16+
} );
17+
}
18+
}

0 commit comments

Comments
 (0)