When using PHP's autoload, why even PHP internal classes will be loaded, such as using pdo,autoload will try to load pdo.php. How to avoid this situation?
function __autoload($className){ require_once APP_PATH.'Controller/'.$className.'.php';}
Reply content:
When using PHP's autoload, why even PHP internal classes will be loaded, such as using pdo,autoload will try to load pdo.php. How to avoid this situation?
function __autoload($className){ require_once APP_PATH.'Controller/'.$className.'.php';}
Are you sure the class name is correct when using the PDO class? namesapce
PDO
to use use
or write in \POD
the form below. Also make sure your PDO extension has been followed and loaded properly.
The inner class is MINIT
loaded at the time, takes precedence over the request, either the class name of the inner class is not written, or the extension of the inner class is not loaded.
If you use namespaces, you need to declare
use PDO;
Or when you create an object with
new \PDO