Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版本中小程序的模板消息报错 #13

Open
leeyifei opened this issue Sep 5, 2019 · 0 comments
Open

新版本中小程序的模板消息报错 #13

leeyifei opened this issue Sep 5, 2019 · 0 comments

Comments

@leeyifei
Copy link

leeyifei commented Sep 5, 2019

Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: abei2017\wx\mini\template\Template::accessToken'

in /home/www-data/workspace/kangyi/php/shopping/vendor/yiisoft/yii2/base/Component.php:154

当前版本 1.3.4
`
class Template extends Driver {

const API_SEND_TMPL = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=';

/**
 * 发送模板消息
 *
 * @param $toUser
 * @param $templateId
 * @param $formId
 * @param $data
 * @param array $extra
 */
public function send($toUser,$templateId,$formId,$data,$extra = []){
    $params = array_merge([
        'touser'=>$toUser,
        'template_id'=>$templateId,
        'form_id'=>$formId,
        'data'=>$data,
    ],$extra);
    $response = $this->post(self::API_SEND_TMPL.$this->accessToken->getToken(),$params)->setFormat(Client::FORMAT_JSON)->send();

    return $response->getContent();
}

}
`

accesstoken未定义

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant