Thinkphp3.2 introduces the php instantiation class. if your class library does not use a namespace, you need to use the import method to load the class library file before instantiating It. for example: we define a Counter class (located in Com/Sina/Util/Counter. class. php ):
- Class Counter {
- }
When using this function, you need to call it as follows:
- Import ('com. Sina. Util. Couter ');
- $ Object = new \ Counter ();
The preceding example is provided by thinkphp.
In actual use, I directly include
Require (APP_PATH. 'admin/Controller/disqus-api/wp-api.php '); // import the disqusApi class, which is copied from wordpress wp_api.php
Require (APP_PATH. 'admin/Controller/disqus-api/category. php ');
The above uses two api files in the disqus api folder in wordpress
Before 3.2, I directly added the class name included in "new,
After 3.2
$ Dsq_class = new \ DisqusWordPressAPI ($ message ['short _ name'], $ api_key, $ dsq_user_api_key );
In this way, instantiate
Make a record of the above content