乐于分享
好东西不私藏

UniApp 小程序本地缓存、持久化存储最佳实践

UniApp 小程序本地缓存、持久化存储最佳实践

UniApp 小程序本地缓存、持久化存储最佳实践

前端缓存用不好,小程序迟早要卡爆。本文聚焦 UniApp 框架,手把手教你用对 Storage、躲坑、提性能。


一、UniApp 存储全家桶(跨端兼容)

存储方式
API
容量
有效期
适用场景
异步存
uni.setStorage()
10MB(小程序)
永久
通用,推荐
异步取
uni.getStorage()
-
-
-
同步存
uni.setStorageSync()
同上
永久
小游戏/工具类
同步取
uni.getStorageSync()
-
-
-
删单个
uni.removeStorage()
-
-
清理特定缓存
清全部
uni.clearStorage()
-
-
退出登录等
查信息
uni.getStorageInfo()
-
-
监控容量
// 异步 - 推荐uni.setStorage({  key'userInfo',  data: { name'张三'age25 },  success() {    console.log('存储成功')  }})// 同步uni.setStorageSync('token''abc123')// 读取uni.getStorage({  key'userInfo',  success(res) {    console.log(res.data)  }})// 同步读取const token = uni.getStorageSync('token')// 删除单个uni.removeStorage({ key'tempData' })// 清空全部uni.clearStorage()// 获取存储信息(已用容量、keys列表等)uni.getStorageInfo({  success(res) {    console.log('已用:', res.currentSize'KB')    console.log('限制:', res.limitSize'KB')    console.log('所有keys:', res.keys)  }})

⚠️ 跨端容量差异

平台
容量
注意事项
微信/支付宝小程序
10MB
-
H5 (localStorage)
5MB
超出直接报错
App (原生键值对)
不限
大数据推荐 SQLite
App (SQLite)
不限
适合结构化数据

二、同步 vs 异步:什么时候用什么?

// ❌ 错误示范:同步阻塞渲染onLoad() {  const data = uni.getStorageSync('hugeData')  // 大数据会卡住页面  this.processData(data)}// ✅ 正确做法:异步不阻塞onLoad() {  uni.getStorage({    key'hugeData',    success(res) => {      this.processData(res.data)    }  })}// 或者用 Promise 封装(推荐)const getStorage = (key) => new Promise((resolve, reject) => {  uni.getStorage({    key,    successres => resolve(res.data),    failerr => reject(err)  })})// async/await 用起来更爽async onLoad() {  const data = await getStorage('hugeData')  this.processData(data)}

选型原则

场景
推荐
原因
页面初始化数据
异步
避免白屏等待
大数据量
异步
防止阻塞主线程
简单配置项
同步
代码简洁
用户点击后保存
异步
体验无感知
游戏帧循环中
同步(少量)
游戏主循环特殊

三、Storage 进阶用法(UniApp 封装)

1. 存储对象/数组(必须 JSON 序列化)

// ❌ 错误:直接存对象uni.setStorageSync('user', { name'张三' })const user = uni.getStorageSync('user')console.log(typeof user.name)  // "undefined" - 对象变成了字符串 "[object Object]"// ✅ 正确:JSON.stringify / parseuni.setStorageSync('user'JSON.stringify({ name'张三' }))const user = JSON.parse(uni.getStorageSync('user'))console.log(user.name)  // "张三"

2. 统一工具类 storage.js(核心模板)

// storage.js - 跨端兼容封装const STORAGE_PREFIX = 'app_'/** * 存储(自动 JSON 序列化) */function set(key, value, expire = 0) {  const data = {    value,    expire: expire > 0 ? Date.now() + expire : 0  // 0 表示永不过期  }  // #ifdef MP-WEIXIN  try {    uni.setStorageSync(STORAGE_PREFIX + key, JSON.stringify(data))  } catch (e) {    console.error('存储失败:', e)  }  // #endif  // #ifdef H5  try {    localStorage.setItem(STORAGE_PREFIX + key, JSON.stringify(data))  } catch (e) {    console.error('localStorage 超出限制:', e)  }  // #endif  // #ifdef APP-PLUS  try {    plus.storage.setItem(STORAGE_PREFIX + key, JSON.stringify(data))  } catch (e) {    console.error('App存储失败:', e)  }  // #endif}/** * 读取(自动过期校验) */function get(key, defaultValue = null) {  let raw = null  // #ifdef MP-WEIXIN  try {    raw = uni.getStorageSync(STORAGE_PREFIX + key)  } catch (e) {}  // #endif  // #ifdef H5  raw = localStorage.getItem(STORAGE_PREFIX + key)  // #endif  // #ifdef APP-PLUS  try {    raw = plus.storage.getItem(STORAGE_PREFIX + key)  } catch (e) {}  // #endif  if (!raw) return defaultValue  try {    const data = JSON.parse(raw)    // 过期校验    if (data.expire && Date.now() > data.expire) {      remove(key)      return defaultValue    }    return data.value  } catch (e) {    return defaultValue  }}/** * 删除 */function remove(key) {  // #ifdef MP-WEIXIN  uni.removeStorage({ keySTORAGE_PREFIX + key })  // #endif  // #ifdef H5  localStorage.removeItem(STORAGE_PREFIX + key)  // #endif  // #ifdef APP-PLUS  plus.storage.removeItem(STORAGE_PREFIX + key)  // #endif}/** * 清空用户数据(退出登录用) */function clearUserData() {  const keys = getAllKeys()  keys.forEach(key => {    if (key.startsWith(STORAGE_PREFIX + 'user') ||         key.startsWith(STORAGE_PREFIX + 'token')) {      remove(key.replace(STORAGE_PREFIX''))    }  })}/** * 获取所有 keys */function getAllKeys() {  // #ifdef MP-WEIXIN  try {    const info = uni.getStorageInfoSync()    return info.keys || []  } catch (e) {    return []  }  // #endif  // #ifdef H5  return Object.keys(localStorage)  // #endif  // #ifdef APP-PLUS  return plus.storage.getAllKeys() || []  // #endif}/** * 获取已用存储大小(KB) */function getUsedSize() {  // #ifdef MP-WEIXIN  try {    const info = uni.getStorageInfoSync()    return info.currentSize  } catch (e) {    return 0  }  // #endif  // #ifdef H5  let size = 0  for (let key in localStorage) {    if (localStorage.hasOwnProperty(key)) {      size += localStorage[key].length * 2  // 中文占2字节    }  }  return Math.ceil(size / 1024)  // #endif  return 0}export default {  set,  get,  remove,  clearUserData,  getAllKeys,  getUsedSize}

3. 存储监听器(变化时自动刷新)

// pages/index/index.vueexport default {  data() {    return {      userInfonull    }  },  onLoad() {    // 初始化读取    this.loadUserInfo()    // #ifdef MP-WEIXIN    // 微信小程序使用 watch    this.$watch('userInfo'(newVal) => {      console.log('userInfo 变化了:', newVal)    })    // #endif  },  methods: {    loadUserInfo() {      // 读取缓存      const cache = storage.get('userInfo')      if (cache) {        this.userInfo = cache      }      // 异步加载最新      this.fetchUserInfo()    },    async fetchUserInfo() {      try {        const res = await uni.request({ url'/api/user/info' })        this.userInfo = res.data        // 更新缓存        storage.set('userInfo', res.data)      } catch (e) {        console.error('获取用户信息失败', e)      }    }  }}

四、缓存清理策略

1. 手动清理

// 清理单个storage.remove('tempData')// 清理全部uni.clearStorage()// 清理用户相关storage.clearUserData()

2. 自动过期(TTL)

// 存一个1小时后过期的数据storage.set('captcha''1234'60 * 60 * 1000)// 获取时自动判断过期,返回 nullconst captcha = storage.get('captcha')if (!captcha) {  // 重新获取}

3. 容量监控 + 自动清理

// utils/cacheCleaner.jsconst MAX_SIZE_KB = 8 * 1024  // 8MB 预警export function autoCleanup() {  const used = storage.getUsedSize()  const limit = 10 * 1024  // 小程序总限额 10MB  if (used > MAX_SIZE_KB) {    console.warn(`存储容量告警: ${used}KB / ${limit}KB`)    // 清理过期缓存    const keys = storage.getAllKeys()    keys.forEach(key => {      // 只清理非关键数据(临时、缓存类)      if (key.includes('temp') || key.includes('cache')) {        storage.remove(key)      }    })  }}// 在 App 启动时检查onLaunch() {  autoCleanup()}

4. 退出登录清空

// 登录退出时调用functionlogout() {  // 1. 调用后端退出接口  uni.request({ url'/api/logout'method'POST' })  // 2. 清理本地用户数据  storage.clearUserData()  // 3. 跳转登录页  uni.reLaunch({ url'/pages/login/login' })}

五、用户信息缓存实战

1. 登录态 Token 存储

// 登录时存储async function login(phone, code) {  try {    const res = await uni.request({      url: '/api/login',      method: 'POST',      data: { phone, code }    })    // 存储 token    storage.set('token', res.data.token)    storage.set('refreshToken', res.data.refreshToken)    // 存储过期时间(假设token 7 天过期)    const expireTime = Date.now() + 7 * 24 * 60 * 60 * 1000    storage.set('tokenExpire', expireTime)    return res.data  } catch (e) {    console.error('登录失败', e)    throw e  }}// 请求拦截器自动带上 tokenuni.addInterceptor('request', {  asyncinvoke(args) {    const token = storage.get('token')    if (token) {      args.header = args.header || {}      args.header['Authorization'] = `Bearer ${token}`    }    return args  }})

2. 用户信息缓存 + 刷新机制

// 获取用户信息(离线优先)async function getUserInfo(forceRefresh = false) {  // 1. 先取缓存(离线可用)  const cache = storage.get('userInfo')  if (cache && !forceRefresh) {    return cache  }  // 2. 异步请求最新  try {    const res = await uni.request({ url: '/api/user/info' })    // 3. 更新缓存    storage.set('userInfo', res.data)    return res.data  } catch (e) {    // 4. 请求失败返回缓存(离线降级)    if (cache) {      console.warn('离线模式,返回缓存数据')      return cache    }    throw e  }}

3. App 端设备 ID 存储

// #ifdef APP-PLUSfunction getDeviceId() {  let deviceId = storage.get('deviceId')  if (!deviceId) {    const info = plus.push.getClientInfo()    deviceId = info.clientid || info.deviceid || generateUUID()    storage.set('deviceId', deviceId)  }  return deviceId}// #endiffunction generateUUID() {  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/gc => {    const r = Math.random() * 16 | 0    return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)  })}

六、UniApp 特有的持久化方案

1. App 端 SQLite(结构化大数据)

// App 端使用 SQLite 插件// 需要先在 manifest.json 配置第三方模块// sqlite.jslet db = nullexport function initDatabase() {  // #ifdef APP-PLUS  db = uni.requireNativePlugin('sqlite')  db.open({    name'mydb',  // 数据库名    path'_doc/mydb.db'  // 保存路径  })  // 创建表  db.execute({    sql`CREATE TABLE IF NOT EXISTS users (      id INTEGER PRIMARY KEY,      name TEXT,      phone TEXT,      avatar TEXT,      update_time INTEGER    )`,    success() => console.log('表创建成功'),    fail(e) => console.error('建表失败', e)  })  // #endif}// 增删改查export function insertUser(user) {  // #ifdef APP-PLUS  db.execute({    sql'INSERT INTO users (id, name, phone, avatar, update_time) VALUES (?, ?, ?, ?, ?)',    args: [user.id, user.name, user.phone, user.avatarDate.now()],    success() => console.log('插入成功'),    fail(e) => console.error('插入失败', e)  })  // #endif}export function queryUser(id) {  return new Promise((resolve, reject) => {    // #ifdef APP-PLUS    db.select({      sql'SELECT * FROM users WHERE id = ?',      args: [id],      success(res) => resolve(res),      fail(e) => reject(e)    })    // #endif    // #ifndef APP-PLUS    resolve(null)    // #endif  })}

2. App 端原生键值对

// #ifdef APP-PLUS// plus.storage 是 App 原生 API,性能优于 Storage APIplus.storage.setItem('key''value')const val = plus.storage.getItem('key')plus.storage.removeItem('key')plus.storage.clear()plus.storage.getLength()plus.storage.getAllKeys()// #endif// 封装兼容写法function setItem(key, value) {  // #ifdef APP-PLUS  plus.storage.setItem(key, value)  // #endif  // #ifndef APP-PLUS  uni.setStorageSync(key, value)  // #endif}

3. H5 端 localStorage 兼容写法

// #ifdef H5function h5Set(key, value) {  try {    localStorage.setItem(key, JSON.stringify(value))  } catch (e) {    // quota exceeded 超出配额    if (e.name === 'QuotaExceededError') {      console.error('localStorage 已满,需要清理')      // 清理旧缓存      cleanupOldData()      // 重试      localStorage.setItem(key, JSON.stringify(value))    }  }}// #endif

七、性能优化技巧

1. 懒加载:按需读取

// ❌ 一次全加载onLoad() {  this.loadAllData()  // 慢}// ✅ 按需加载onLoad(options) {  if (options.type === 'profile') {    this.loadUserProfile()  // 只加载需要的  } else if (options.type === 'settings') {    this.loadSettings()  }}

2. 分片存储:大数据拆分

// 存储大数组时分片function setLargeData(key, data) {  const CHUNK_SIZE = 100  // 每片100条  const chunks = Math.ceil(data.length / CHUNK_SIZE)  storage.set(key + '_meta', { total: chunks, length: data.length })  for (let i = 0; i < chunks; i++) {    const chunk = data.slice(i * CHUNK_SIZE, (i + 1) * CHUNK_SIZE)    storage.set(key + '_chunk_' + i, chunk)  }}// 读取时合并function getLargeData(key) {  const meta = storage.get(key + '_meta')  if (!meta) return []  const result = []  for (let i = 0; i < meta.total; i++) {    const chunk = storage.get(key + '_chunk_' + i)    result.push(...chunk)  }  return result}

3. 内存 + Storage 二级缓存

// 内存缓存(当前页面生命周期内有效)const memoryCache = {}function getWithCache(key) {  // 先查内存  if (memoryCache[key]) {    console.log('命中内存缓存')    return Promise.resolve(memoryCache[key])  }  // 再查 Storage  return storage.get(key).then(data => {    if (data) {      memoryCache[key] = data  // 存入内存    }    return data  })}// 页面离开时清理内存缓存onUnload() {  // 只清理非全局缓存  Object.keys(memoryCache).forEach(key => {    if (!key.startsWith('global_')) {      delete memoryCache[key]    }  })}

4. 小程序端定期清理

// #ifdef MP-WEIXIN// 在 pages.json 配置 "persistent": false 的页面自动被清理// 或者手动清理onShow() {  this.checkAndCleanup()}methods: {  checkAndCleanup() {    // 检查存储使用量    uni.getStorageInfo({      success(res) => {        // 如果使用超过 80%        if (res.currentSize / res.limitSize > 0.8) {          this.cleanupOldCache()        }      }    })  },  cleanupOldCache() {    // 清理带过期时间但已过期的数据    const keys = storage.getAllKeys()    let cleanedCount = 0    keys.forEach(key => {      // 跳过关键数据      if (key.includes('token') || key.includes('userInfo')) return      const value = storage.get(key)      // 如果存储结构包含过期时间且已过期      if (value && value._expire && Date.now() > value._expire) {        storage.remove(key)        cleanedCount++      }    })    console.log(`清理了 ${cleanedCount} 个过期缓存`)  }}// #endif

八、避坑指南

问题
原因
解决方案
H5 存不进去
localStorage 只有 5MB,超出就报错
清理旧数据 / 分片存储 / 删除不必要的 key
App 端存储失败
数据类型问题或权限问题
try-catch 包裹 + JSON.stringify 序列化
小程序容量超标
数据积累未定期清理
设置容量预警 + 自动清理机制
数据类型丢失
对象直接存,拿出来是字符串 [object Object]
始终用 JSON.stringify() 存,JSON.parse() 取
退出登录没清干净
只清了 token,没清用户信息
封装 clearUserData() 统一清理
同步阻塞页面
在 onLoad 中用了同步读取大数据
改用异步或 onShow 中懒加载
H5 隐私模式
Safari/微信小程序 H5 无痕模式下 localStorage 不可用
改用 sessionStorage 或 try-catch 兜底
数据过期判断失效
存进去的格式和读取时校验的格式不一致
统一存储格式: { value, expire }
多端 key 冲突
小程序和 H5 共用同一个 key
加前缀区分:app_token vs h5_token

关键代码检查清单

// ✅ 存之前uni.setStorage({  key'myKey',  dataJSON.stringify(myObject),  // 记得序列化})// ✅ 取出来const raw = uni.getStorageSync('myKey')if (raw) {  const obj = JSON.parse(raw)  // 记得反序列化}// ✅ 异常兜底try {  uni.setStorageSync('key'JSON.stringify(data))catch (e) {  console.error('存储失败,可能超出容量', e)  // 触发清理或提示用户}// ✅ 退出登录storage.clearUserData()  // 不要只清 token

九、快速复制模板

storage.js 完整版

// storage.js - UniApp 跨端存储工具库// 支持:微信小程序 / H5 / Appconst PREFIX = 'myapp_'/** * 统一存储接口 * @param {stringkey - 键名 * @param {anyvalue - 值(自动 JSON 序列化) * @param {numberexpire - 过期时间(ms),0 永不过期 */function set(key, value, expire = 0) {  const data = {    value,    expire: expire > 0 ? Date.now() + expire : 0  }  const str = JSON.stringify(data)  try {    // #ifdef MP-WEIXIN    uni.setStorageSync(PREFIX + key, str)    // #endif    // #ifdef H5    localStorage.setItem(PREFIX + key, str)    // #endif    // #ifdef APP-PLUS    plus.storage.setItem(PREFIX + key, str)    // #endif    return true  } catch (e) {    console.error(`[Storage] set ${key} failed:`, e.message)    return false  }}/** * 统一读取接口 * @param {stringkey - 键名 * @param {anydefaultValue - 默认值 */function get(key, defaultValue = null) {  let str = null  try {    // #ifdef MP-WEIXIN    str = uni.getStorageSync(PREFIX + key)    // #endif    // #ifdef H5    str = localStorage.getItem(PREFIX + key)    // #endif    // #ifdef APP-PLUS    str = plus.storage.getItem(PREFIX + key)    // #endif  } catch (e) {    console.error(`[Storage] get ${key} failed:`, e.message)    return defaultValue  }  if (!str) return defaultValue  try {    const data = JSON.parse(str)    // 过期检查    if (data.expire && Date.now() > data.expire) {      remove(key)      return defaultValue    }    return data.value  } catch (e) {    return defaultValue  }}/** * 删除指定键 */function remove(key) {  try {    // #ifdef MP-WEIXIN    uni.removeStorage({ keyPREFIX + key })    // #endif    // #ifdef H5    localStorage.removeItem(PREFIX + key)    // #endif    // #ifdef APP-PLUS    plus.storage.removeItem(PREFIX + key)    // #endif  } catch (e) {    console.error(`[Storage] remove ${key} failed:`, e.message)  }}/** * 清空所有带前缀的键 */function clear() {  try {    // #ifdef MP-WEIXIN    uni.clearStorage()    // #endif    // #ifdef H5    Object.keys(localStorage)      .filter(k => k.startsWith(PREFIX))      .forEach(k => localStorage.removeItem(k))    // #endif    // #ifdef APP-PLUS    plus.storage.clear()    // #endif  } catch (e) {    console.error('[Storage] clear failed:', e.message)  }}/** * 清理用户相关数据(退出登录用) */function clearUser() {  const keys = getAllKeys()  keys.filter(k =>     k.includes('user') ||     k.includes('token') ||     k.includes('profile')  ).forEach(k => remove(k.replace(PREFIX'')))}/** * 获取所有键名 */function getAllKeys() {  try {    // #ifdef MP-WEIXIN    return uni.getStorageInfoSync().keys || []    // #endif    // #ifdef H5    return Object.keys(localStorage)    // #endif    // #ifdef APP-PLUS    return plus.storage.getAllKeys() || []    // #endif  } catch (e) {    return []  }}/** * 获取已用存储大小(KB) */function getUsedSize() {  try {    // #ifdef MP-WEIXIN    return uni.getStorageInfoSync().currentSize || 0    // #endif    // #ifdef H5    return Object.values(localStorage)      .reduce((sum, v) => sum + v.length * 20) / 1024    // #endif    // #ifdef APP-PLUS    return 0  // App 原生 API 不直接支持    // #endif  } catch (e) {    return 0  }}export default {  set,  get,  remove,  clear,  clearUser,  getAllKeys,  getUsedSize}

pages/index/index.vue 使用示例

<template>  <viewclass="container">    <text>用户名称: {{ userName }}</text>    <button @click="saveData">保存数据</button>    <button @click="loadData">读取数据</button>    <button @click="clearData">清理数据</button>  </view></template><script>import storage from '@/utils/storage.js'export default {  data() {    return {      userName''    }  },  onLoad() {    this.loadData()  },  methods: {    // 保存(带2小时过期)    saveData() {      storage.set('userName''张三'2 * 60 * 60 * 1000)      uni.showToast({ title'保存成功' })    },    // 读取    loadData() {      this.userName = storage.get('userName''未登录')    },    // 清理用户数据    clearData() {      storage.clearUser()      this.userName = '未登录'      uni.showToast({ title'已清理' })    }  }}</script>

总结

要点
关键操作
存取值
始终 JSON.stringify / parse
大数据
异步读取 + 分片存储
敏感数据
App 端加密 + 只存必要信息
退出登录
统一清理 clearUser()
容量监控
定期检查 getStorageInfo
过期机制
自定义时间戳校验
多端兼容#ifdef
 条件编译 + try-catch

记住:Storage 不是数据库,别把它当 MySQL 用。大数据、关系型数据用 SQLite,配置类用 Storage,临时缓存注意过期和清理。

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-05-31 16:55:06 HTTP/1.1 GET : https://www.yeyulingfeng.com/a/689190.html
  2. 运行时间 : 0.211414s [ 吞吐率:4.73req/s ] 内存消耗:4,781.36kb 文件加载:145
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=5ec3fb5561633a13a1ee75e674074a2e
  1. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_static.php ( 6.05 KB )
  7. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/ralouphie/getallheaders/src/getallheaders.php ( 1.60 KB )
  10. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  11. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  12. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  13. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  14. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  15. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  16. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  17. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  18. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  19. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions_include.php ( 0.16 KB )
  21. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions.php ( 5.54 KB )
  22. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  23. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  24. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  25. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/provider.php ( 0.19 KB )
  26. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  27. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  28. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  29. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/common.php ( 0.03 KB )
  30. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  32. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/alipay.php ( 3.59 KB )
  33. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  34. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/app.php ( 0.95 KB )
  35. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cache.php ( 0.78 KB )
  36. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/console.php ( 0.23 KB )
  37. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cookie.php ( 0.56 KB )
  38. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/database.php ( 2.48 KB )
  39. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/filesystem.php ( 0.61 KB )
  40. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/lang.php ( 0.91 KB )
  41. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/log.php ( 1.35 KB )
  42. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/middleware.php ( 0.19 KB )
  43. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/route.php ( 1.89 KB )
  44. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/session.php ( 0.57 KB )
  45. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/trace.php ( 0.34 KB )
  46. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/view.php ( 0.82 KB )
  47. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/event.php ( 0.25 KB )
  48. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  49. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/service.php ( 0.13 KB )
  50. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/AppService.php ( 0.26 KB )
  51. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  52. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  53. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  54. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  55. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  56. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/services.php ( 0.14 KB )
  57. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  58. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  59. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  60. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  61. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  62. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  63. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  64. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  65. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  66. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  67. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  68. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  69. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  70. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  71. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  72. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  73. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  74. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  75. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  76. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  77. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  78. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  79. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  80. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  81. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  82. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  83. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  84. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  85. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  86. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  87. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/Request.php ( 0.09 KB )
  88. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  89. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/middleware.php ( 0.25 KB )
  90. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  91. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  92. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  93. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  94. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  95. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  96. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  97. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  98. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  99. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  100. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  101. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  102. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  103. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/route/app.php ( 3.94 KB )
  104. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  105. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  106. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Index.php ( 9.87 KB )
  108. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/BaseController.php ( 2.05 KB )
  109. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  110. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  111. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  112. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  113. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  114. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  115. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  116. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  117. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  118. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  119. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  120. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  121. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  122. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  123. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  124. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  125. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  126. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  127. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  128. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  129. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  130. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  131. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  132. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  133. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  134. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  135. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Es.php ( 3.30 KB )
  136. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  137. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  138. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  139. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  140. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  141. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  142. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  143. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  144. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/runtime/temp/c935550e3e8a3a4c27dd94e439343fdf.php ( 31.50 KB )
  145. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000882s ] mysql:host=127.0.0.1;port=3306;dbname=wenku;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000831s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000314s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000288s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000468s ]
  6. SELECT * FROM `set` [ RunTime:0.000194s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000581s ]
  8. SELECT * FROM `article` WHERE `id` = 689190 LIMIT 1 [ RunTime:0.000607s ]
  9. UPDATE `article` SET `lasttime` = 1780217706 WHERE `id` = 689190 [ RunTime:0.001169s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000212s ]
  11. SELECT * FROM `article` WHERE `id` < 689190 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000419s ]
  12. SELECT * FROM `article` WHERE `id` > 689190 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000890s ]
  13. SELECT * FROM `article` WHERE `id` < 689190 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000702s ]
  14. SELECT * FROM `article` WHERE `id` < 689190 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000743s ]
  15. SELECT * FROM `article` WHERE `id` < 689190 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000725s ]
0.213157s