littlemo/baidu

the littlemo baidu utils

v1.0.0 2021-11-15 07:23 UTC

This package is auto-updated.

Last update: 2024-10-15 14:22:17 UTC


README

Total Downloads Latest Stable Version Latest Unstable Version PHP Version License

介绍

php常用工具库

安装教程

composer.json

{
    "require": {
        "littlemo/baidu": "~1.0.0"
    }
}

使用说明

公共

===

公共部分被所有方法继承,实例化任意类均可调用

use littlemo\baidu\Class;

$Class = new Class($apiKey, $secretKey, $planId );

实例化参数

获取Access Token

百度AIP开放平台使用OAuth2.0授权调用开放API,调用API时必须在URL中带上access_token参数

示例代码
use littlemo\wechat\Class;

$Class = new Class($apiKey, $secretKey);

$result = $Class->access_token();

if ($result) {
    echo '获取Access token成功';
    $token = $Class->getMessage();
} else {
    echo "获取Access token失败";
    $errorMsg = $Class->getErrorMsg();
}

//查询完整的回调消息
$intactMsg = $Class->getIntactMsg();

返回示例

{
  "refresh_token": "25.b55fe1d287227ca97aab219bb249b8ab.315360000.1798284651.282335-8574074",
  "expires_in": 2592000,
  "scope": "public wise_adapt",
  "session_key": "9mzdDZXu3dENdFZQurfg0Vz8slgSgvvOAUebNFzyzcpQ5EnbxbF+hfG9DQkpUVQdh4p6HbQcAiz5RmuBAja1JJGgIdJI",
  "access_token": "24.6c5e1ff107f0e8bcef8c46d3424a0e78.2592000.1485516651.282335-8574074",
  "session_secret": "dfac94a3489fe9fca7c3221cbf7525ff"
}

官方文档

明镜实名认证方案(H5)

整理中...

参与贡献

  1. littlemo

特技

  • 统一、精简