获取服务器时间

场景描述

在前端不使用用户计算机的日期时间,而使用服务器的日期时间

实现思路

在页面的设计器中,使用“服务器时间”方法获取服务器的日期时间

对应的js方法是 wx.Date.getServerDatetime() 方法

方法原理说明

服务器时间方法并不直接发送请求获取服务器时间,而是通过其他请求间接获取服务器时间。即当用户修改用户计算机的日期时间后,只要发送过新的网络请求,通过该方法获取的服务器时间就是正确的。

results matching ""

    No results matching ""

    results matching ""

      No results matching ""