小编TRO*_*DON的帖子

将没有命名空间的类导入到命名空间类

我有一个类,它包括Smarty,但我的类使用命名空间测试,Smarty不使用命名空间.如何包括Smarty,而无需将名称空间写入智能文件(它有许多系统插件)

    import "smarty/Smarty.php"

    class testik
    {
        public function __construct ()
        {
            $smarty = new Smarty();
        }
    }


<?php

    class Smarty
    {
        //somcode
    }
Run Code Online (Sandbox Code Playgroud)

Smarty有自动加载器类并包含其插件,插件也没有命名空间.

php namespaces smarty3

19
推荐指数
1
解决办法
1万
查看次数

标签 统计

namespaces ×1

php ×1

smarty3 ×1