1.首先在http://open-doc.dingtalk.com/microapp/serverapi2/vzzrkv中下载PHP版本SDK。解压后文件目录如图:

111.jpeg

这里我只用到dingtalk中的文件,删除aliyun、QimenCloud目录,保留top目录Autoloader.phpTopSdk.php文件。

2、composer.json中:

"autoload": {
    "classmap": [
        "database"
    ],
    "files":[
        "app/Packages/taobao/TopSdk.php"
    ],
    "psr-4": {
        "App\\": "app/"
    }
 
}

别忘记:然后执行composer dump-autoload

3、执行完毕后,在Controller中就可以直接使用DingTalk SDK了。测试结果如下(注意要加‘ \ ’):

object(DingTalkClient)#276 (9) { ["gatewayUrl"]=> string(34) "http://eco.taobao.com/router/rest" ["format"]=> string(4) "json" ["connectTimeout"]=> NULL ["readTimeout"]=> NULL ["apiCallType"]=> string(4) "oapi" ["httpMethod"]=> string(4) "POST" ["checkRequest"]=> bool(true) ["apiVersion":protected]=> string(3) "2.0" ["sdkVersion":protected]=> string(25) "dingtalk-sdk-php-20161214" }

本文转载:https://blog.csdn.net/xiaoweite1/article/details/106175892

标签: Laravel、Thinkphp6等现在代框架引入钉钉SDK

添加新评论