smarty3

Importing class without namespace to namespaced class

假如想象 提交于 2019-11-27 21:35:55
问题 I have a some class, it include Smarty, but my class use namespace test, Smarty don't use namespaces. How include Smarty, without writing namespaces into smarty files (it has many system plugins) import "smarty/Smarty.php" class testik { public function __construct () { $smarty = new Smarty(); } } <?php class Smarty { //somcode } Smarty has autoloader class and include its plugins, plugins haven't namespaces too. 回答1: Tell your namespaced code it's in the global namespace: $smarty = new