其他人无法正常使用小程序?
发布于 4 年前 作者 fxiang 9485 次浏览 来自 官方Issues

小程序只有登录页面和一个首页。。使用开发者的微信号可以正常登录。可是其他微信号只能打开登录页面,点击登录无法跳转到首页!请问下各位大神这个是在哪里设置有问题呀?

    JS代码:
  
  
    login: function() {
          var that = this;
          wx.showLoading({
            title: '服务器连接中',
    }),
    wx.request({
      url: 'https://www.ailaiyun.com/login.php',
      method: "post",
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      data: {
        name: that.data.name,
        password: that.data.password,
      },
      
      success(res) {
        wx.hideLoading();
        if (res.data != null) {
          wx.setStorage({
            key:"user_info",
            data:res.data
          });
          wx.navigateTo({
            url: '../index/index',
          });
          
        } else {
          wx.showToast({
            title: "用户名或密码错误",
            icon: 'none',
          })
        }
      }
    })
  }

   后端代码:

<?php
$db = mysqli_connect("xx.xx.xx.xx","xx","xx",'xx','3306') or die("数据库连接失败");//连接数据库
mysqli_query($db,"set names utf8");
$name =$_POST["name"];
$password= $_POST["password"];
$hash_password = hash("sha256", $password );

$sql="SELECT * from user where email='$name' and pass='$hash_password'";
$result= mysqli_query($db,$sql);
while ($row = mysqli_fetch_array($result)) {
    $res[] = $row;
}
echo json_encode($res);
?>
3 回复

经过排查发现请求服务器request返回failed。并且只有安卓手机有这个现象。发现是服务器缺少中间证书2导致。。在服务器添加中间证书2后一切恢复正常

登录用到了请求接口?request域名没配置?

不发代码猜不出来

回到顶部