jquery.js:9930 还是报错 POST http://localhost:29790/MasterPage.master/GetServerTime 404 (Not Found)
时间: 2023-12-26 12:04:45 浏览: 27
这个错误信息是因为你的页面中引用的jQuery代码尝试向"http://localhost:29790/MasterPage.master/GetServerTime"发送POST请求,但是这个地址并不存在,所以返回了404错误。你需要检查一下这个地址是否正确或者是否存在,如果不存在就需要修改代码中的请求地址。另外,你还需要确保请求的方法和参数正确无误。
相关问题
init: async function () { wx.cloud.init() const res = await wx.cloud.callFunction({name: 'getServerTime'}); // 使用await等待异步请求结果 console.log('服务器时间:',res.result) app.globalData.servertime = res.result; const um = wx.getUpdateManager() um.onCheckForUpdate(res => res.hasUpdate && um.onUpdateReady(() => um.applyUpdate())) console.log('systemInfo: ', this.globalData.systemInfo = wx.getSystemInfoSync()) this.globalData.isIOS = this.globalData.systemInfo.system.substring(0, 3) == 'iOS' },报错信息是:ReferenceError: app is not defined at ft._callee$ (app.js? [sm]:67) at L (regenerator.js:1) at Generator._invoke (regenerator.js:1) at Generator.t.<computed> [as next] (regenerator.js:1) at asyncGeneratorStep (asyncToGenerator.js:1) at c (asyncToGenerator.js:1)(env: macOS,mp,1.06.2303220; lib: 2.32.0)
这个错误提示是因为在你的代码中使用了一个未定义的变量 `app`。这可能是由于你没有在当前作用域中定义 `app` 变量,或者是因为你使用了一个已经被删除的 `app` 变量。可以检查一下你的代码中是否有定义过 `app` 变量,或者在使用 `app` 变量之前是否已经初始化过。如果你确定 `app` 变量已经被正确初始化,可以尝试在引入文件的时候检查一下路径是否正确。
上面的代码报错remote_time = conn.getServerTime() AttributeError: 'SMBConnection' object has no attribute 'getServerTime'
根据提供的引用,这个错误是因为`SMBConnection`对象没有`getServerTime()`属性导致的。因此,我们需要检查代码中是否正确地创建了`conn`对象,并且该对象是否是`SMBConnection`类型。如果是,我们需要查看`SMBConnection`类的文档,以确定是否有`getServerTime()`方法。如果没有,我们需要查找其他方法来获取远程服务器的时间。
如果您确定`conn`对象是正确创建的,并且是`SMBConnection`类型,但仍然无法解决问题,则可以尝试以下方法:
```python
# 导入相应的库
from smb.SMBConnection import SMBConnection
import datetime
# 创建SMBConnection对象
conn = SMBConnection('username', 'password', 'my_client', 'remote_server', use_ntlm_v2=True)
assert conn.connect('remote_server_ip', 139)
# 获取远程服务器的时间
remote_time = conn.getAttributes('remote_file_path')['last_write_time']
remote_time = datetime.datetime.fromtimestamp(remote_time)
print("Remote server time: ", remote_time)
```
这里我们使用了`getAttributes()`方法来获取远程文件的属性,其中包括最后修改时间。然后,我们将时间戳转换为日期时间格式,并打印出来。