国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

php - TP3.2 problem loading third-party libraries
黃舟
黃舟 2017-06-27 09:17:46
0
1
1066

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 indexcontroller

Error: 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.

黃舟
黃舟

人生最曼妙的風景,竟是內(nèi)心的淡定與從容!

reply all(1)
typecho
在引入的文件中加個命名空間
namespace Codebase\Phpmailer;

使用的時候就
use Codebase\Phpmailer\Phpmailer;

請注意你的首字母大小寫,以及不是class.phpmailer.php,而是Phpmailer.class.php
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template