Third-party libraries are often used in thinkphp development. I usually put the third-party class libraries in the Application/Codebase/ directory. Because many third-party libraries do not have namespaces, I don't want to add namespaces one by one. How to load the class library file in the Codebase directory?
For example, my tp project directory structure
I want to load the class.phpmailer.php file (without namespace) under CodebasephpMailer. What should I do? It is best to load it automatically.
I read the manual to use class library mapping. I created a new alias.php in commonconf, the code is as follows
return array(
'Codebase\phpMailer' => APP_PATH.'/Codebase/phpMailer/class.phpmailer.php',
);
Then I $obj=new CodebasephpMailerPHPMailer();
in indexcontrollerError: Class 'CodebasephpMailerPHPMailer' not found
How to deal with it? There is another question. The class loading error message in TP usually shows this error. How do I know which file it is looking for the class in? I can’t see the specific path information, so it is difficult to troubleshoot.
人生最曼妙的风景,竟是内心的淡定与从容!