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

2个小程序 公用的一套接口 #2631

Closed
1535050440 opened this issue Dec 10, 2022 · 4 comments
Closed

2个小程序 公用的一套接口 #2631

1535050440 opened this issue Dec 10, 2022 · 4 comments

Comments

@1535050440
Copy link

`
public function __construct($soft_type = '')
{
if ($soft_type == 'love_my') {
$this->app_id = 'wx98a8164';
$this->secret = 'f090bc71436883527ea65258';
} else {
$this->app_id = env('WECHAT_MINI_PROGRAM_APPID');
$this->secret = env('WECHAT_MINI_PROGRAM_SECRET');
}

    $this->config = [
        'app_id' => $this->app_id,
        'secret' => $this->secret,
        'token' => 'easywechat',
        'aes_key' => '' // 明文模式请勿填写 EncodingAESKey
    ];

    print_r($this->config);



        $this->app = new Application($this->config);`
@1535050440
Copy link
Author

Array
(
[errcode] => 40001
[errmsg] => invalid credential, access_token is invalid or not latest rid: 639461eb-26cde93d-4fecb553
)

@1535050440
Copy link
Author

2个微信小程序 ,可以公用一套代码吗?但是我在__construct 实例化时做了区分。结果手机号一直提示access_token 错误 ,access_token 有值

@1535050440
Copy link
Author


$data = [
            'code' => $mobile_code,
        ];

        $access_token_wwq = $this->app->getClient()->postJson('wxa/business/getuserphonenumber', $data);


        echo "\n";
        echo "\n";
        print_r($data);
        print_r($access_token_wwq->toArray());

@overtrue
Copy link
Collaborator

所以提问的时候为啥要清空模板不按模版来提问呢?没有上下文别人很难帮助你啊。

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

2 participants