当前位置:首页>java>函数式编程

函数式编程

  • 2026-02-07 14:54:31
函数式编程

Lambda 表达式

Lambda表达式是Java 8引入的一个重要特性,它提供了一种简洁的方式来表示匿名函数。

Lambda表达式的语法

Lambda表达式的基本语法是:(parameters) -> expression 或 (parameters) -> { statements; }

语法形式示例说明
无参数() -> System.out.println("Hello")无参数的Lambda表达式
单个参数x -> x + 1单个参数可省略括号
多个参数(x, y) -> x + y多个参数需要用括号
有类型声明(int x, int y) -> x + y带类型声明的参数
多条语句(x, y) -> { int sum = x + y; return sum; }多条语句需要用花括号

Lambda表达式示例

public class LambdaExample {    public static void basicLambdaExamples() {        // 无参Lambda        Runnable runnable = () -> System.out.println("Hello from Lambda!");        runnable.run();        // 单参Lambda        Function<StringInteger> stringToInt = s -> s.length();        System.out.println("Length: " + stringToInt.apply("Hello"));        // 多参Lambda        BinaryOperator<Integer> add = (x, y) -> x + y;        System.out.println("Sum: " + add.apply(53));        // 带类型声明的Lambda        BinaryOperator<Integer> multiply = (Integer x, Integer y) -> x * y;        System.out.println("Product: " + multiply.apply(46));        // 多语句Lambda        Function<IntegerString> processNumber = (Integer num) -> {            if (num > 0) {                return "Positive: " + num;            } else if (num < 0) {                return "Negative: " + num;            } else {                return "Zero";            }        };        System.out.println(processNumber.apply(-5));    }    // Lambda与集合操作    public static void lambdaWithCollections() {        List<String> names = Arrays.asList("Alice""Bob""Charlie""David");        // 使用Lambda表达式遍历集合        names.forEach(name -> System.out.println(name));        // 使用方法引用(Method Reference)        names.forEach(System.out::println);        // 使用Lambda过滤        names.stream()             .filter(name -> name.startsWith("A"))             .forEach(System.out::println);    }}

Stream API

Stream API是Java 8引入的另一个重要特性,提供了函数式编程的能力,可以对集合进行各种操作。

Stream操作类型

操作类型说明示例
中间操作返回Stream,可以链式调用filtermapsorteddistinct
终端操作返回结果或副作用,结束StreamcollectforEachreducecount

Stream常用方法

方法说明示例
filter(Predicate<T>)过滤元素stream.filter(x -> x > 5)
map(Function<T,R>)转换元素stream.map(String::length)
flatMap(Function<T,Stream<R>>)扁平化映射stream.flatMap(list -> list.stream())
distinct()去重stream.distinct()
sorted()排序stream.sorted()
limit(long n)限制元素数量stream.limit(5)
skip(long n)跳过元素stream.skip(2)
forEach(Consumer<T>)遍历stream.forEach(System.out::println)
collect(Collectors)收集结果stream.collect(Collectors.toList())
reduce(BinaryOperator<T>)归约操作stream.reduce(Integer::sum)
count()计数stream.count()
findFirst()获取第一个元素stream.findFirst()
anyMatch(Predicate<T>)是否任意匹配stream.anyMatch(x -> x > 10)
allMatch(Predicate<T>)是否全部匹配stream.allMatch(x -> x > 0)
noneMatch(Predicate<T>)是否都不匹配stream.noneMatch(x -> x < 0)

Stream API 示例

public static void basicStreamOperations() {    List<Integer> numbers = Arrays.asList(12345678910);    // 过滤偶数并求平方    List<Integer> evenSquares = numbers.stream()        .filter(n -> n % 2 == 0)  // 过滤偶数        .map(n -> n * n)          // 求平方        .collect(Collectors.toList());  // 收集结果    System.out.println("Even squares: " + evenSquares);    // 字符串操作示例    List<String> words = Arrays.asList("hello""world""java""stream""api");    List<String> upperWords = words.stream()        .filter(word -> word.length() > 4)  // 过滤长度大于4的单词        .map(String::toUpperCase)           // 转大写        .sorted()                           // 排序        .collect(Collectors.toList());    System.out.println("Filtered and transformed words: " + upperWords);    // 数字流操作    int sum = IntStream.rangeClosed(1100)        .filter(n -> n % 2 == 0)  // 偶数        .sum();                   // 求和    System.out.println("Sum of even numbers 1-100: " + sum);}public static void advancedStreamOperations() {    List<Person> people = Arrays.asList(        new Person("Alice"25"Engineer"),        new Person("Bob"30"Designer"),        new Person("Charlie"35"Engineer"),        new Person("David"28"Manager"),        new Person("Eve"32"Engineer")    );    // 按职业分组    Map<StringList<Person>> groupedByJob = people.stream()        .collect(Collectors.groupingBy(Person::getJob));    System.out.println("Grouped by job: " + groupedByJob);    // 按年龄统计    IntSummaryStatistics ageStats = people.stream()        .mapToInt(Person::getAge)        .summaryStatistics();    System.out.println("Age statistics: " + ageStats);    // 查找特定条件的元素    Optional<Person> engineer = people.stream()        .filter(p -> p.getJob().equals("Engineer"))        .findFirst();    engineer.ifPresent(p -> System.out.println("First engineer: " + p.getName()));    // 字符串连接    String names = people.stream()        .map(Person::getName)        .collect(Collectors.joining(", "));    System.out.println("Names joined: " + names);}// 并行流示例public static void parallelStreamExample() {    List<Integer> numbers = IntStream.rangeClosed(11000000)        .boxed()        .collect(Collectors.toList());    // 串行流    long startTime = System.currentTimeMillis();    long serialSum = numbers.stream()        .mapToLong(Long::valueOf)        .sum();    long serialTime = System.currentTimeMillis() - startTime;    // 并行流    startTime = System.currentTimeMillis();    long parallelSum = numbers.parallelStream()        .mapToLong(Long::valueOf)        .sum();    long parallelTime = System.currentTimeMillis() - startTime;    System.out.println("Serial sum: " + serialSum + ", time: " + serialTime + "ms");    System.out.println("Parallel sum: " + parallelSum + ", time: " + parallelTime + "ms");}// 内部类用于示例static class Person {    private String name;    private int age;    private String job;    public Person(String name, int age, String job) {        this.name = name;        this.age = age;        this.job = job;    }    // getter方法    public String getName() { return name; }    public int getAge() { return age; }    public String getJob() { return job; }    @Override    public String toString() {        return String.format("Person{name='%s', age=%d, job='%s'}", name, age, job);   	 }	}}

Optional 类

Optional是Java 8引入的容器类,用于解决空指针异常问题。

Optional常用方法

方法说明示例
Optional.empty()创建空OptionalOptional<String> opt = Optional.empty();
Optional.of(value)创建非空OptionalOptional<String> opt = Optional.of("Hello");
Optional.ofNullable(value)创建可能为空的OptionalOptional<String> opt = Optional.ofNullable(str);
isPresent()检查是否有值opt.isPresent()
isEmpty()检查是否为空opt.isEmpty() (Java 11+)
get()获取值(不安全)opt.get()
orElse(defaultValue)获取值或默认值opt.orElse("Default")
orElseGet(Supplier)惰性获取默认值opt.orElseGet(() -> computeDefault())
orElseThrow()无值时抛异常opt.orElseThrow()
orElseThrow(Supplier)无值时抛指定异常opt.orElseThrow(() -> new CustomException())
ifPresent(Consumer)有值时执行opt.ifPresent(System.out::println)
ifPresentOrElse(Consumer, Runnable)有值/无值分别处理opt.ifPresentOrElse(...) (Java 9+)
filter(Predicate)过滤opt.filter(s -> s.length() > 5)
map(Function)转换opt.map(String::length)
flatMap(Function)扁平化转换opt.flatMap(this::processString)

Optional示例

public class OptionalExample {    public static void basicOptionalOperations() {        // 创建Optional的不同方式        Optional<String> emptyOpt = Optional.empty();        Optional<String> nonEmptyOpt = Optional.of("Hello");        Optional<String> nullableOpt = Optional.ofNullable(null);        // 检查值是否存在        System.out.println("Empty opt present: " + emptyOpt.isPresent());        System.out.println("Non-empty opt present: " + nonEmptyOpt.isPresent());        // 获取值或默认值        String value1 = emptyOpt.orElse("Default Value");        String value2 = nonEmptyOpt.orElse("Default Value");        System.out.println("Value from empty opt: " + value1);        System.out.println("Value from non-empty opt: " + value2);        // 使用ifPresent处理值        nonEmptyOpt.ifPresent(s -> System.out.println("Got value: " + s));        // 使用map转换值        Optional<Integer> lengthOpt = nonEmptyOpt.map(String::length);        lengthOpt.ifPresent(len -> System.out.println("Length: " + len));        // 使用filter过滤        Optional<String> filteredOpt = nonEmptyOpt            .filter(s -> s.length() > 10)            .map(String::toUpperCase);        System.out.println("Filtered result: " + filteredOpt.orElse("Not found"));    }    // Optional在实际业务中的应用    public static void practicalOptionalUsage() {        UserService userService = new UserService();        // 传统方式(容易出现NPE)        User user1 = userService.findById(1L);        if (user1 != null) {            Profile profile = user1.getProfile();            if (profile != null) {                Address address = profile.getAddress();                if (address != null) {                    System.out.println("Address: " + address.getCity());                }            }        }        // 使用Optional的优雅方式        Optional.ofNullable(userService.findById(1L))            .map(User::getProfile)            .map(Profile::getAddress)            .map(Address::getCity)            .ifPresent(city -> System.out.println("Address: " + city));        // 处理可能的异常情况        String result = Optional.ofNullable(userService.findById(999L))            .map(User::getProfile)            .map(Profile::getEmail)            .orElse("No email found");        System.out.println("Email result: " + result);    }    // 内部类用于示例    static class UserService {        public User findById(Long id) {            if (id == 1L) {                return new User("John Doe"new Profile("john@example.com"new Address("New York")));            }            return null;        }    }    static class User {        private String name;        private Profile profile;        public User(String name, Profile profile) {            this.name = name;            this.profile = profile;        }        public Profile getProfile() { return profile; }    }    static class Profile {        private String email;        private Address address;        public Profile(String email, Address address) {            this.email = email;            this.address = address;        }        public String getEmail() { return email; }        public Address getAddress() { return address; }    }    static class Address {        private String city;        public Address(String city) {            this.city = city;        }        public String getCity() { return city; }    }}

函数式接口

函数式接口是只有一个抽象方法的接口,可以被Lambda表达式实现。

常用函数式接口

接口抽象方法用途示例
Predicate<T>boolean test(T t)断言,返回booleanx -> x > 5
Function<T,R>R apply(T t)转换,接收T返回Rx -> x * 2
Consumer<T>void accept(T t)消费,接收T不返回x -> System.out.println(x)
Supplier<T>T get()供应,不接收返回T() -> new Object()
UnaryOperator<T>T apply(T t)一元操作,T->Tx -> x.toUpperCase()
BinaryOperator<T>T apply(T t1, T t2)二元操作,(T,T)->T(x, y) -> x + y
BiFunction<T,U,R>R apply(T t, U u)二元函数,(T,U)->R(x, y) -> x + y
BiConsumer<T,U>void accept(T t, U u)二元消费,(T,U)(x, y) -> System.out.println(x + y)

自定义函数式接口

@FunctionalInterfacepublic interface Calculator {    int calculate(int a, int b);// 可以有默认方法default void printResult(int result) {    System.out.println("Result: " + result);}// 可以有静态方法static Calculator getAdditionCalculator() {    return (a, b) -> a + b;	} public class FunctionalInterfaceExample {    public static void demonstrateCustomFunctionalInterface() {        Calculator addition = (a, b) -> a + b;        Calculator multiplication = (a, b) -> a * b;       int addResult = addition.calculate(53);    int multResult = multiplication.calculate(53);    addition.printResult(addResult);    multiplication.printResult(multResult);    Calculator defaultCalc = Calculator.getAdditionCalculator();    defaultCalc.printResult(defaultCalc.calculate(1020));	}}

最新文章

随机文章

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