index.wxml
<!--index.wxml-->
<view class="container">
<!-- 用户 openid -->
<view class="userinfo">
<view>
//index.js
const app = getApp()
Page({
data: {
avatarUrl: './user-unlogin.png',
userInfo: {},
logged: false,
takeSession:
<button
open-type="getUserInfo"
bindgetuseri
部署login云函数后获取openid。
用户关注公众号后会基于该公众号给该用户分配一个唯一标识openid。
通过这个openid就能获取该用户的部分信息。
用户关注的不同的公众号有不同的openid。
微信公众号模式获取用户openid
<?php echo urlencode("http://jianhaozhan.cn/weixin1/getCode.php") ?>
编码后:
http%3A%2F%2Fjianhaozhan.cn%2Fweixin1%2FgetCode.php