Advertisement
chrisenoch

autoload.php

Mar 29th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2. function autoloader($className) {
  3. $fileName = str_replace('\\', '/', $className) . '.php';
  4. //Try anove with only one backslash and note error code. Research this.
  5. $file = __DIR__ . '/../classes/' . $fileName;
  6.  
  7. include $file;
  8. }
  9.  
  10. spl_autoload_register('autoloader'); // Why is there a string here? Will it still work if I change it? How does this work?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement