乐于分享
好东西不私藏

Flutter跨平台插件开发与发布Pub实战

Flutter跨平台插件开发与发布Pub实战

一、 环境准备与插件项目初始化

做什么:在开始编写代码前,我们需要搭建好开发环境并使用Flutter命令创建一个包含多平台配置的插件模板项目。

怎么做:请确保你已经安装了Flutter SDK,并配置了Android Studio、Xcode(macOS)以及Visual Studio(Windows包含C++桌面开发工作负载)。打开终端,使用`flutter create`命令并指定`--template=plugin`来生成插件。为了同时支持Android、iOS和Windows,我们必须通过`--platforms`参数显式声明。

为什么:Flutter默认的插件模板可能只包含Android和iOS。显式指定平台参数可以确保Flutter CLI自动为我们生成对应平台的底层原生通信代码和配置文件,省去手动建立目录和修改配置的繁琐工作。

bash
# 进入你的工作目录cd ~/projects  # 使用flutter create命令创建插件项目# -t plugin 表示创建插件模板# --platforms 指定要支持的平台# com.example.battery 为你插件的包名前缀,建议使用自己的域名倒排 fluttercreate--template=plugin--platforms=android,ios,windows-akotlin-iswift-ccppbattery_plugin  # 进入项目目录查看生成的文件结构cd battery_plugin ls-R 

二、 插件Dart端接口设计

做什么:编写对外暴露的Dart API。这部分代码是跨平台的,无论底层是哪个操作系统,Flutter应用调用的都是这套统一的接口。

怎么做:在生成的`lib/battery_plugin_method_channel.dart`和`lib/battery_plugin.dart`中编写代码。我们使用`MethodChannel`与原生端进行通信。定义一个方法名(例如`getBatteryLevel`),并通过`invokeMethod`触发底层调用。

为什么:Dart端是连接Flutter UI和原生底层的桥梁。保持Dart接口的纯洁性和良好的容错处理(如PlatformException捕获),能让使用你插件的开发者获得最佳体验。

dart
// lib/battery_plugin_method_channel.dartimport'package:flutter/foundation.dart';import'package:flutter/services.dart';import'battery_plugin_platform_interface.dart';/// MethodChannel实现类,负责与原生端通信classBatteryPluginMethodChannelextends BatteryPluginPlatform {/// 创建名为 'battery_plugin' 的通信通道@visibleForTestingfinal methodChannel =const MethodChannel('battery_plugin');@override  Future<int?> getBatteryLevel() async {try {// 通过invokeMethod调用原生端的 'getBatteryLevel' 方法final level =await methodChannel.invokeMethod<int>('getBatteryLevel');return level;    } on PlatformException catch (e) {// 捕获原生端抛出的异常      debugPrint("Failed to get battery level: '${e.message}'.");returnnull;    }  }}// lib/battery_plugin.dartimport'battery_plugin_platform_interface.dart';classBatteryPlugin {/// 对外暴露的获取电量方法  Future<int?> getBatteryLevel() {return BatteryPluginPlatform.instance.getBatteryLevel();  }}

三、 Android平台兼容实现 (Kotlin)

做什么:实现Android端获取电池电量的原生逻辑。

怎么做:打开`android/src/main/kotlin/你的包名/BatteryPluginPlugin.kt`。实现`onMethodCall`回调,当收到`getBatteryLevel`指令时,使用Android系统的`BatteryManager`获取当前电量百分比并返回。

为什么:每个操作系统的底层API完全不同。Android通过系统服务获取硬件信息,我们需要在对应的原生代码中注册对应的监听并处理Flutter发来的消息。

kotlin
// android/src/main/kotlin/com/example/battery/BatteryPluginPlugin.ktpackage com.example.battery_pluginimport android.content.Contextimport android.os.BatteryManagerimport androidx.annotation.NonNullimport io.flutter.embedding.engine.plugins.FlutterPluginimport io.flutter.plugin.common.MethodCallimport io.flutter.plugin.common.MethodChannelimport io.flutter.plugin.common.MethodChannel.MethodCallHandlerimport io.flutter.plugin.common.MethodChannel.ResultclassBatteryPluginPlugin: FlutterPlugin, MethodCallHandler {privatelateinitvar channel : MethodChannelprivatelateinitvar context: ContextoverridefunonAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {    channel = MethodChannel(flutterPluginBinding.binaryMessenger"battery_plugin")    channel.setMethodCallHandler(this)    context = flutterPluginBinding.applicationContext  }overridefunonMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {if (call.method=="getBatteryLevel") {// 获取Android系统的BatteryManagerval batteryManager = context.getSystemService(Context.BATTERY_SERVICEas BatteryManager// 获取电量百分比 (0-100)val batteryLevel = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)if (batteryLevel !=-1) {        result.success(batteryLevel)      } else {        result.error("UNAVAILABLE""Battery level not available."null)      }    } else {      result.notImplemented()    }  }overridefunonDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {    channel.setMethodCallHandler(null)  }}

四、 iOS平台兼容实现 (Swift)

做什么:实现iOS端获取电池电量的原生逻辑。

怎么做:打开`ios/Classes/BatteryPluginPlugin.swift`。重写`handle(_ call: FlutterMethodCall)`方法。使用iOS的`UIDevice`来获取电池信息。需要注意,iOS获取真实电量前必须开启`isBatteryMonitoringEnabled`。

为什么:iOS有严格的沙盒机制和API调用规范,电池状态属于受保护的用户隐私状态信息,需要开启监听开关才能读取到具体数值(返回值为0到1的浮点数)。

swift
// ios/Classes/BatteryPluginPlugin.swiftimportFlutterimportUIKitpublicclassBatteryPluginPlugin: NSObject, FlutterPlugin {publicstaticfuncregister(with registrar: FlutterPluginRegistrar) {let channel = FlutterMethodChannel(name: "battery_plugin", binaryMessenger: registrar.messenger())let instance = BatteryPluginPlugin()    registrar.addMethodCallDelegate(instance, channel: channel)  }publicfunchandle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {switch call.method {case"getBatteryLevel":// 必须开启电池监控才能获取到真实电量      UIDevice.current.isBatteryMonitoringEnabled = truelet state = UIDevice.current.batteryStateif state == .unknown {        result(FlutterError(code: "UNAVAILABLE", message: "Battery level not available.", details: nil))      } else {// iOS电池电量返回的是0.0到1.0的浮点数,需转换为百分比整数let batteryLevel = Int(UIDevice.current.batteryLevel *100)        result(batteryLevel)      }default:      result(FlutterMethodNotImplemented)    }  }}

五、 Windows平台兼容实现 (C++)

做什么:实现Windows桌面端获取电池电量的底层逻辑。

怎么做:打开`windows/battery_plugin_plugin.cpp`。在`HandleMethodCall`方法中,判断方法名,如果匹配,则调用Windows系统API获取电源状态。Windows端需要引入``并使用`GetSystemPowerStatus`函数。

为什么:Windows桌面平台的硬件接口与移动端截然不同。在Windows中,系统电源状态是通过结构体`SYSTEM_POWER_STATUS`来表征的,我们需要解析这个结构体中的`BatteryLifePercent`字段。

cpp
// windows/battery_plugin_plugin.cpp#include"battery_plugin_plugin.h"#include<windows.h>#include<flutter/method_channel.h>#include<flutter/plugin_registrar_windows.h>#include<flutter/standard_method_codec.h>#include<memory>#include<sstream>namespace battery_plugin {voidBatteryPluginPlugin::RegisterWithRegistrar(    flutter::PluginRegistrarWindows *registrar) {auto channel =      std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(          registrar->messenger(), "battery_plugin",&flutter::StandardMethodCodec::GetInstance());auto plugin = std::make_unique<BatteryPluginPlugin>();  channel->SetMethodCallHandler(      [plugin_pointer = plugin.get()](constauto&call, auto result) {        plugin_pointer->HandleMethodCall(call, std::move(result));      });  registrar->AddPlugin(std::move(plugin));}BatteryPluginPlugin::BatteryPluginPlugin() {}BatteryPluginPlugin::~BatteryPluginPlugin() {}void BatteryPluginPlugin::HandleMethodCall(const flutter::MethodCall<flutter::EncodableValue>&method_call,    std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {if (method_call.method_name().compare("getBatteryLevel"==0) {    SYSTEM_POWER_STATUS status;// 调用Windows API获取系统电源状态if (GetSystemPowerStatus(&status)) {// BatteryLifePercent 返回值是 0-100,255表示未知状态if (status.BatteryLifePercent !=255) {        result->Success(flutter::EncodableValue((int)status.BatteryLifePercent));      } else {        result->Error("UNAVAILABLE""Battery level not available.");      }    } else {      result->Error("SYSTEM_ERROR""Failed to get system power status.");    }  } else {    result->NotImplemented();  }}// namespace battery_plugin

六、 编写测试用例验证插件

做什么:在`example`项目中编写UI代码,调用我们刚刚开发的插件,在三个平台上分别进行验证。

怎么做:打开`example/lib/main.dart`,编写一个带有按钮和文本的简单界面。点击按钮时调用`BatteryPlugin().getBatteryLevel()`,并通过`setState`更新界面显示。连接你的Android/iOS手机或启动Windows桌面应用进行测试。

为什么:开发完成后必须进行功能验证。通过example项目可以以真实App的方式运行插件,这是确保MethodChannel通信无异常的必要步骤。

dart
// example/lib/main.dartimport'package:flutter/material.dart';import'package:battery_plugin/battery_plugin.dart';void main() {  runApp(const MyApp());}classMyAppextends StatelessWidget {const MyApp({super.key});@override  Widget build(BuildContext context) {return MaterialApp(      title: 'Plugin Demo',      home: const BatteryHomePage(),    );  }}classBatteryHomePageextends StatefulWidget {const BatteryHomePage({super.key});@override  State<BatteryHomePage> createState() => _BatteryHomePageState();}class_BatteryHomePageStateextends State<BatteryHomePage> {final _batteryPlugin = BatteryPlugin();String _batteryLevel ='Unknown';  Future<void> _getBatteryLevel() async {final level =await _batteryPlugin.getBatteryLevel();    setState(() {      _batteryLevel = level !=null?'$level%':'Failed to get battery level.';    });  }@override  Widget build(BuildContext context) {return Scaffold(      appBar: AppBar(        title: const Text('跨平台插件测试'),      ),      body: Center(        child: Column(          mainAxisAlignment: MainAxisAlignment.center,          children: [            Text('当前电量: $_batteryLevel', style: const TextStyle(fontSize: 24)),const SizedBox(height: 20),            ElevatedButton(              onPressed: _getBatteryLevel,              child: const Text('获取设备电量'),            ),          ],        ),      ),    );  }}

七、 完善发布配置与文档

做什么:在正式上传到pub.dev之前,必须完善`pubspec.yaml`文件,提供清晰的README.md说明文档以及CHANGELOG.md版本记录。

怎么做:修改插件根目录下的`pubspec.yaml`,填写description、version、homepage等元数据。同时编写介绍插件功能和使用方法的README文件。然后运行`flutter pub publish --dry-run`进行发布前检查。

为什么:pub.dev有着严格的包质量评分体系。完善的描述、合法的版本号、详尽的文档和通过的代码静态分析,决定了你的插件能否获得高Pub Points,从而被更多开发者发现和使用。

yaml
# pubspec.yamlnamebattery_plugindescription一个用于获取设备电池电量的跨平台Flutter插件,支持Android, iOS和Windows。version0.0.1# 初始版本号,每次发布必须递增homepagehttps://github.com/yourname/battery_plugin# 你的开源仓库地址environment:sdk'>=2.19.0<4.0.0'flutter">=3.3.0"dependencies:flutter:sdkflutterplugin_platform_interface^2.0.2# 跨平台接口必备依赖dev_dependencies:flutter_test:sdkflutterflutter_lints^2.0.0# 声明这是一个Flutter插件及其支持的平台flutter:plugin:platforms:android:packagecom.example.battery_pluginpluginClassBatteryPluginPluginios:pluginClassBatteryPluginPluginwindows:pluginClassBatteryPluginPlugin

八、 将插件发布上传至pub.dev

做什么:将经过本地测试且无报错的插件正式上传到Flutter官方包仓库。

怎么做:打开终端,确保当前路径位于插件根目录。首先执行`flutter pub publish --dry-run`检查包内容。如果没有报错,执行`flutter pub publish`命令。系统会自动打开浏览器要求你使用Google账号授权pub.dev的上传权限。授权完成后,终端将自动完成上传。

为什么:`--dry-run`可以防止你在不知情的情况下上传错误的文件或失败的测试。授权步骤是pub.dev保障包所有者身份安全的必要机制。上传成功后,全球开发者就可以通过`flutter pub add`使用你的插件了。

bash
# 确保所有的静态分析通过 flutteranalyze  # 运行测试 flutter test# 执行发布前的模拟打包检查,这会验证pubspec.yaml和所有文件结构 flutterpubpublish--dry-run  # 如果一切正常,执行真正的发布命令 flutterpubpublish  # 如果遇到网络问题,可以配置国内或官方的镜像代理(可选)# export PUB_HOSTED_URL=https://pub.dev# export FLUTTER_STORAGE_BASE_URL=https://storage.googleapis.com

✨ 至此,从零开始开发一款同时兼容Android、iOS、Windows三大平台的Flutter插件,并成功发布到pub.dev的完整流程就已经梳理完毕。核心关键在于使用统一的MethodChannel进行跨平台消息分发,并在各自的工程目录下编写原生实现。掌握了这套标准模板,未来无论是接入硬件蓝牙、串口通信,还是各种独特的底层SDK,你都可以按照这套架构游刃有余地进行扩展。感谢你的阅读,快去开发你的第一个跨平台插件吧!

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-06-24 20:41:47 HTTP/1.1 GET : https://www.yeyulingfeng.com/a/791249.html
  2. 运行时间 : 0.188440s [ 吞吐率:5.31req/s ] 内存消耗:4,794.14kb 文件加载:145
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=0dab3e4bc17b2625897dc9ea927e18e8
  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.000997s ] mysql:host=127.0.0.1;port=3306;dbname=wenku;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001551s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000755s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000578s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001385s ]
  6. SELECT * FROM `set` [ RunTime:0.000538s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001345s ]
  8. SELECT * FROM `article` WHERE `id` = 791249 LIMIT 1 [ RunTime:0.001080s ]
  9. UPDATE `article` SET `lasttime` = 1782304907 WHERE `id` = 791249 [ RunTime:0.003754s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000610s ]
  11. SELECT * FROM `article` WHERE `id` < 791249 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001097s ]
  12. SELECT * FROM `article` WHERE `id` > 791249 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001036s ]
  13. SELECT * FROM `article` WHERE `id` < 791249 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000998s ]
  14. SELECT * FROM `article` WHERE `id` < 791249 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000656s ]
  15. SELECT * FROM `article` WHERE `id` < 791249 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000767s ]
0.190063s