thinkPHP3.1怎么实例化第三方扩展的类


扩展包上传到/htdocs/ThinkPHP/Extend/Vendor/Qiniu 了。
Auth.php 里是个Auth类。 怎么new这个类呢
用下面这个导入,new Auth()的时候提示Auth类不存在怎么办、

直接require绝对路径new就没问题
import('Qiniu.Auth');


 //这种new报错
        /* import('Qiniu.Auth');
        import('Qiniu.Http.Client');
        import('Qiniu.Http.Request');
        import('Qiniu.Http.Response');
        import('Qiniu.Storage.BucketManager');
        import('Qiniu.Config');
        import('Qiniu.functions');
        import('Qiniu.Storage.UploadManager'); */
    //这种没问题 require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Auth.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Config.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/functions.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Http/Client.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Http/Request.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Http/Response.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Storage/BucketManager.php');
        require_once('/data/home/qxu1098240152/htdocs/ThinkPHP/Extend/Vendor/Qiniu/Storage/UploadManager.php');


        //echo __FILE__;
        $accessKey = '';
        $secretKey = '';
        $auth = new Auth($accessKey, $secretKey);
        $bucketMgr = New BucketManager($auth);

55952352829c9.png

thinkphp php

你妹临死前 9 years, 5 months ago

已解决:


 Vendor('Qiniu.Auth');
        Vendor('Qiniu.Config');
        Vendor('Qiniu.functions');
        Vendor('Qiniu.Http.Client');
        Vendor('Qiniu.Http.Request');
        Vendor('Qiniu.Http.Response');
        Vendor('Qiniu.Storage.BucketManager');
        Vendor('Qiniu.Storage.UploadManager');

乱投硬币打死 answered 9 years, 5 months ago

Your Answer