当前位置:首页>php>PHP + Elasticsearch 实战:从零搭建全文搜索引擎,支持中文分词和高亮显示

PHP + Elasticsearch 实战:从零搭建全文搜索引擎,支持中文分词和高亮显示

  • 2026-07-02 16:52:56
PHP + Elasticsearch 实战:从零搭建全文搜索引擎,支持中文分词和高亮显示
更多课程体系,关注以上公众号

摘要:你的 MySQL LIKE 查询拖垮了整个系统?是时候上 Elasticsearch 了。本文带你从 ES 安装、IK 中文分词、PHP 客户端集成,到高亮显示、分页、聚合统计,一步步搭建一套真正可用于生产的全文搜索引擎,附完整可运行代码和性能对比数据(查询速度提升 120 倍)。


一、痛点:LIKE 查询有多惨?

先看一段让无数后端泪目的代码:

// 经典的 MySQL 模糊查询 —— 看起来没什么问题
$keyword = '高性能 PHP 开发';
$articles = DB::table('articles')
    ->where('title''LIKE'"%{$keyword}%")
    ->orWhere('content''LIKE'"%{$keyword}%")
    ->get();

数据量小的时候一切正常,数据量到 100 万+ 之后:

场景
MySQL LIKE
Elasticsearch
100万条数据查询
4200ms
35ms
1000万条数据查询
超时/OOM
80ms
中文分词支持
不支持
原生支持(IK)
相关性排序
TF-IDF / BM25
高亮显示
需手动处理
原生支持
聚合统计
毫秒级

一句话:MySQL LIKE 是拿锤子做手术刀的活,Elasticsearch 才是为搜索而生的工具。


二、Elasticsearch 核心概念快速入门

在上代码之前,用 3 个类比把 ES 概念说清楚:

MySQL          →  Elasticsearch
数据库(Database) →  索引(Index)
表(Table)       →  类型(Type,已废弃,8.x 用 Index)
行(Row)         →  文档(Document)
列(Column)      →  字段(Field)
Schema         →  Mapping
SQL 查询        →  DSL 查询

三个最重要的原理

  1. 倒排索引(Inverted Index)
    :把「文档→词」的关系反转为「词→文档列表」,搜索时直接命中,O(1) 查找
  2. 分词器(Analyzer)
    :把一段文字拆成词项(Token),中文必须用 IK 分词器
  3. 相关性评分(BM25)
    :词频(TF)× 逆文档频率(IDF),自动排出最相关的结果

三、环境搭建(5分钟跑通)

3.1 Docker Compose 一键启动

# docker-compose.yml
version:'3.8'
services:
elasticsearch:
image:elasticsearch:8.13.0
container_name:es01
environment:
-discovery.type=single-node
-xpack.security.enabled=false# 开发环境关闭安全认证
-ES_JAVA_OPTS=-Xms512m-Xmx512m
ports:
-"9200:9200"
volumes:
-es_data:/usr/share/elasticsearch/data
networks:
-es_net

kibana:
image:kibana:8.13.0
container_name:kibana01
environment:
-ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
-"5601:5601"
networks:
-es_net
depends_on:
-elasticsearch

volumes:
es_data:

networks:
es_net:
# 启动服务
docker-compose up -d

# 验证 ES 是否正常
curl http://localhost:9200
# 返回 {"name":"es01","cluster_name":"docker-cluster","version":{"number":"8.13.0",...}}

3.2 安装 IK 中文分词插件

# 进入容器安装 IK 分词器(版本必须与 ES 一致)
docker exec -it es01 bash
./bin/elasticsearch-plugin install \
  https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.13.0/elasticsearch-analysis-ik-8.13.0.zip

# 重启 ES 生效
docker restart es01

IK 分词器两种模式

  • ik_max_word
    :最细粒度拆分,适合建索引(词更多 = 召回更全)
  • ik_smart
    :最粗粒度拆分,适合搜索(语义更准确)

验证分词效果:

curl -X POST "localhost:9200/_analyze" -H 'Content-Type: application/json' -d'{
  "analyzer": "ik_max_word",
  "text": "PHP高性能全文搜索引擎实战"
}'

# 结果: ["PHP", "高性能", "高", "性能", "全文", "搜索", "引擎", "实战"]

3.3 安装 PHP 客户端

composer require elasticsearch/elasticsearch:^8.0

四、完整代码实现

4.1 创建 ES 连接客户端

<?php
// src/Search/ElasticsearchClient.php

namespaceApp\Search;

useElastic\Elasticsearch\ClientBuilder;
useElastic\Elasticsearch\Client;

classElasticsearchClient
{
privatestatic ?Client $instance = null;

/**
     * 获取 ES 客户端单例
     */

publicstaticfunctiongetInstance(): Client
{
if (self::$instance === null) {
self::$instance = ClientBuilder::create()
                ->setHosts(['localhost:9200'])
                ->setRetries(2)                    // 失败自动重试 2 次
                ->build();
        }

returnself::$instance;
    }
}

4.2 创建文章索引(含中文分词 Mapping)

<?php
// src/Search/ArticleIndexManager.php

namespaceApp\Search;

classArticleIndexManager
{
privateconstINDEX_NAME = 'articles';

/**
     * 创建文章索引
     * Mapping 决定了每个字段如何被分析和存储
     */

publicfunctioncreateIndex(): array
{
$client = ElasticsearchClient::getInstance();

// 先删除已存在的索引(开发环境)
if ($client->indices()->exists(['index' => self::INDEX_NAME])->asBool()) {
$client->indices()->delete(['index' => self::INDEX_NAME]);
        }

$params = [
'index' => self::INDEX_NAME,
'body'  => [
// -------- 索引设置 --------
'settings' => [
'number_of_shards'   => 1,   // 分片数(单机建议1)
'number_of_replicas' => 0,   // 副本数(生产环境建议1)
'analysis' => [
// 自定义分析器:IK + 停用词
'analyzer' => [
'ik_custom' => [
'type'      => 'custom',
'tokenizer' => 'ik_max_word',
'filter'    => ['lowercase''stop_filter'],
                            ],
                        ],
'filter' => [
'stop_filter' => [
'type'      => 'stop',
'stopwords' => ['的''了''在''是''我''有''和'],
                            ],
                        ],
                    ],
                ],
// -------- 字段 Mapping --------
'mappings' => [
'properties' => [
'id' => [
'type' => 'integer',
                        ],
'title' => [
'type'            => 'text',
'analyzer'        => 'ik_custom',    // 建索引:最细粒度
'search_analyzer' => 'ik_smart',     // 搜索:最粗粒度
'fields' => [
'keyword' => [                   // 精确匹配子字段
'type' => 'keyword',
                                ],
                            ],
                        ],
'content' => [
'type'            => 'text',
'analyzer'        => 'ik_custom',
'search_analyzer' => 'ik_smart',
                        ],
'author' => [
'type' => 'keyword',                 // 精确匹配,不分词
                        ],
'category' => [
'type' => 'keyword',
                        ],
'tags' => [
'type' => 'keyword',                 // 数组也用 keyword
                        ],
'view_count' => [
'type' => 'integer',
                        ],
'created_at' => [
'type'   => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss||yyyy-MM-dd',
                        ],
                    ],
                ],
            ],
        ];

return$client->indices()->create($params)->asArray();
    }
}

4.3 批量写入文档(高性能 Bulk API)

<?php
// src/Search/ArticleIndexer.php

namespaceApp\Search;

classArticleIndexer
{
privateconstINDEX_NAME = 'articles';
privateconstBULK_SIZE  = 500;  // 每批写入数量

/**
     * 从 MySQL 同步文章到 ES(支持百万级数据)
     *
     * @param array $articles 文章数组
     */

publicfunctionbulkIndex(array$articles): array
{
$client = ElasticsearchClient::getInstance();
$chunks  = array_chunk($articlesself::BULK_SIZE);
$result  = ['success' => 0'failed' => 0];

foreach ($chunksas$chunk) {
$params = ['body' => []];

foreach ($chunkas$article) {
// Bulk API 格式:每条文档需要两行
// 第一行:操作指令(index/create/update/delete)
$params['body'][] = [
'index' => [
'_index' => self::INDEX_NAME,
'_id'    => $article['id'],  // 用 MySQL 主键作为 ES 文档 ID
                    ],
                ];
// 第二行:文档内容
$params['body'][] = [
'id'         => $article['id'],
'title'      => $article['title'],
'content'    => $article['content'],
'author'     => $article['author'],
'category'   => $article['category'],
'tags'       => $article['tags'] ?? [],
'view_count' => (int)$article['view_count'],
'created_at' => $article['created_at'],
                ];
            }

$response = $client->bulk($params);

// 统计写入结果
if ($response['errors']) {
foreach ($response['items'as$item) {
if (isset($item['index']['error'])) {
$result['failed']++;
error_log('ES 写入失败: ' . json_encode($item['index']['error']));
                    } else {
$result['success']++;
                    }
                }
            } else {
$result['success'] += count($chunk);
            }
        }

return$result;
    }

/**
     * 单条文章写入/更新
     */

publicfunctionindexOne(array$article): bool
{
$client = ElasticsearchClient::getInstance();

$response = $client->index([
'index' => self::INDEX_NAME,
'_id'   => $article['id'],
'body'  => $article,
        ]);

returnin_array($response['result'], ['created''updated']);
    }
}

4.4 核心搜索功能(高亮 + 分页 + 聚合)

<?php
// src/Search/ArticleSearcher.php

namespaceApp\Search;

classArticleSearcher
{
privateconstINDEX_NAME = 'articles';

/**
     * 全文搜索:支持高亮、分页、分类过滤
     *
     * @param string $keyword  搜索关键词
     * @param int    $page     当前页码(从1开始)
     * @param int    $perPage  每页数量
     * @param array  $filters  过滤条件,如 ['category' => 'PHP', 'author' => '张三']
     * @return array
     */

publicfunctionsearch(
string$keyword,
int$page = 1,
int$perPage = 10,
array$filters = []
): array
{
$client = ElasticsearchClient::getInstance();

// 构建 Bool 查询(最常用的复合查询)
$boolQuery = [
'must'   => [],   // 必须匹配(影响评分)
'filter' => [],   // 过滤条件(不影响评分,性能更好)
        ];

// ---- must:全文匹配(多字段,标题权重更高)----
$boolQuery['must'][] = [
'multi_match' => [
'query'  => $keyword,
'fields' => [
'title^3',   // title 权重×3,排名更靠前
'content',
                ],
'type'             => 'best_fields',  // 取得分最高的字段
'fuzziness'        => 'AUTO',         // 模糊匹配(容错一两个字)
'minimum_should_match' => '60%',      // 60%词命中即可
            ],
        ];

// ---- filter:精确过滤(不影响评分) ----
if (!empty($filters['category'])) {
$boolQuery['filter'][] = [
'term' => ['category' => $filters['category']],
            ];
        }
if (!empty($filters['author'])) {
$boolQuery['filter'][] = [
'term' => ['author' => $filters['author']],
            ];
        }
if (!empty($filters['tags'])) {
$boolQuery['filter'][] = [
'terms' => ['tags' => (array)$filters['tags']],
            ];
        }
// 时间范围过滤
if (!empty($filters['date_from']) || !empty($filters['date_to'])) {
$range = [];
if (!empty($filters['date_from'])) {
$range['gte'] = $filters['date_from'];
            }
if (!empty($filters['date_to'])) {
$range['lte'] = $filters['date_to'];
            }
$boolQuery['filter'][] = ['range' => ['created_at' => $range]];
        }

$params = [
'index' => self::INDEX_NAME,
'body'  => [
// ---- 分页 ----
'from' => ($page - 1) * $perPage,
'size' => $perPage,

// ---- 查询 ----
'query' => ['bool' => $boolQuery],

// ---- 高亮 ----
'highlight' => [
'pre_tags'  => ['<em class="search-highlight">'],  // 高亮前缀
'post_tags' => ['</em>'],
'fields'    => [
'title'   => ['number_of_fragments' => 0],      // 标题不截断
'content' => [
'number_of_fragments' => 3,   // 最多3段摘要
'fragment_size'        => 150// 每段150字
                        ],
                    ],
                ],

// ---- 聚合(分类统计) ----
'aggs' => [
'by_category' => [
'terms' => [
'field' => 'category',
'size'  => 10,
                        ],
                    ],
'by_author' => [
'terms' => [
'field' => 'author',
'size'  => 5,
                        ],
                    ],
                ],

// ---- 评分 + 热度联合排序 ----
'sort' => [
'_score',  // 先按相关性
                    ['view_count' => ['order' => 'desc']],  // 相关性相同时按热度
                ],
            ],
        ];

$response = $client->search($params);
return$this->formatResult($response->asArray(), $perPage);
    }

/**
     * 格式化搜索结果
     */

privatefunctionformatResult(array$responseint$perPage): array
{
$hits  = $response['hits'];
$items = [];

foreach ($hits['hits'as$hit) {
$source    = $hit['_source'];
$highlight = $hit['highlight'] ?? [];

$items[] = [
'id'         => $source['id'],
// 有高亮则用高亮内容,否则用原始标题
'title'      => $highlight['title'][0] ?? $source['title'],
// 内容摘要:优先用高亮片段,没有就截取前200字
'summary'    => !empty($highlight['content'])
                    ? implode(' ... '$highlight['content'])
                    : mb_substr($source['content'], 0200) . '...',
'author'     => $source['author'],
'category'   => $source['category'],
'tags'       => $source['tags'],
'view_count' => $source['view_count'],
'created_at' => $source['created_at'],
'_score'     => $hit['_score'],
            ];
        }

// 处理聚合结果
$aggregations = [];
if (isset($response['aggregations'])) {
foreach ($response['aggregations'as$aggName => $aggData) {
$aggregations[$aggName] = array_map(
                    fn($bucket) => [
'key'   => $bucket['key'],
'count' => $bucket['doc_count'],
                    ],
$aggData['buckets']
                );
            }
        }

return [
'total'        => $hits['total']['value'],
'per_page'     => $perPage,
'items'        => $items,
'aggregations' => $aggregations,
'took_ms'      => $response['took'],  // ES 内部查询耗时(毫秒)
        ];
    }

/**
     * 搜索建议(自动补全)
     * 用于搜索框的实时提示
     */

publicfunctionsuggest(string$prefixint$size = 5): array
{
$client = ElasticsearchClient::getInstance();

$params = [
'index' => self::INDEX_NAME,
'body'  => [
'query' => [
'match_phrase_prefix' => [
'title' => [
'query'     => $prefix,
'max_expansions' => 10,
                        ],
                    ],
                ],
'size'    => $size,
'_source' => ['title'],  // 只返回标题字段,减少数据传输
            ],
        ];

$response = $client->search($params);

returnarray_map(
            fn($hit) => $hit['_source']['title'],
$response['hits']['hits']
        );
    }
}

4.5 Laravel 集成(ServiceProvider + Facade)

<?php
// app/Providers/ElasticsearchServiceProvider.php

namespaceApp\Providers;

useApp\Search\ArticleSearcher;
useApp\Search\ArticleIndexer;
useElastic\Elasticsearch\ClientBuilder;
useIlluminate\Support\ServiceProvider;

classElasticsearchServiceProviderextendsServiceProvider
{
publicfunctionregister(): void
{
// 绑定 ES 客户端(单例)
$this->app->singleton('elasticsearch', function () {
returnClientBuilder::create()
                ->setHosts(config('elasticsearch.hosts', ['localhost:9200']))
                ->build();
        });

// 绑定搜索服务
$this->app->singleton(ArticleSearcher::class);
$this->app->singleton(ArticleIndexer::class);
    }

publicfunctionboot(): void
{
$this->publishes([
__DIR__ . '/../../config/elasticsearch.php' => config_path('elasticsearch.php'),
        ]);
    }
}
<?php
// app/Http/Controllers/SearchController.php

namespaceApp\Http\Controllers;

useApp\Search\ArticleSearcher;
useIlluminate\Http\Request;

classSearchControllerextendsController
{
publicfunction__construct(
privatereadonly ArticleSearcher $searcher
{}

/**
     * 文章搜索接口
     * GET /api/search?keyword=PHP高性能&category=PHP&page=1
     */

publicfunctionsearch(Request $request)
{
$request->validate([
'keyword' => 'required|string|min:1|max:100',
'page'    => 'integer|min:1',
'category' => 'nullable|string',
        ]);

$startTime = microtime(true);

$result = $this->searcher->search(
keyword$request->get('keyword'),
page:    $request->get('page'1),
perPage10,
filters$request->only(['category''author''tags''date_from''date_to']),
        );

$result['php_time_ms'] = round((microtime(true) - $startTime) * 10002);

returnresponse()->json([
'code'    => 0,
'message' => 'ok',
'data'    => $result,
        ]);
    }

/**
     * 搜索建议接口(自动补全)
     * GET /api/search/suggest?q=PHP
     */

publicfunctionsuggest(Request $request)
{
$suggestions = $this->searcher->suggest(
$request->get('q'''),
size8
        );

returnresponse()->json(['data' => $suggestions]);
    }
}

五、数据同步策略

生产环境最头疼的不是搜索,而是数据一致性:MySQL 更新了,ES 里的数据怎么同步?

方案一:MySQL Binlog + Canal(推荐)

MySQL Binlog → Canal Server → Canal Client → ES Bulk Write

优点:完全解耦,不改业务代码,延迟 < 1s
实现:Canal 监听 binlog,PHP Worker 消费并写 ES

<?php
// 简化版 Canal 消费者(实际生产用 Canal PHP 客户端)
classCanalConsumer
{
publicfunctionconsume(array$event): void
{
$indexer = newArticleIndexer();

match ($event['type']) {
'INSERT''UPDATE' => $indexer->indexOne($event['data']),
'DELETE'           => $this->deleteFromEs($event['data']['id']),
        };
    }

privatefunctiondeleteFromEs(int$id): void
{
ElasticsearchClient::getInstance()->delete([
'index' => 'articles',
'id'    => $id,
        ]);
    }
}

方案二:Observer + 队列(Laravel 项目首选)

<?php
// app/Observers/ArticleObserver.php

namespaceApp\Observers;

useApp\Jobs\SyncArticleToEs;
useApp\Models\Article;

classArticleObserver
{
// 创建/更新时异步同步到 ES
publicfunctionsaved(Article $article): void
{
dispatch(newSyncArticleToEs($article->id, 'upsert'))
            ->onQueue('elasticsearch');  // 专用队列,避免阻塞主队列
    }

// 删除时从 ES 移除
publicfunctiondeleted(Article $article): void
{
dispatch(newSyncArticleToEs($article->id, 'delete'))
            ->onQueue('elasticsearch');
    }
}

// app/Models/Article.php
classArticleextendsModel
{
protectedstaticfunctionbooted(): void
{
static::observe(ArticleObserver::class);
    }
}

六、性能实测数据

测试环境:8核16G,1000万条文章数据,关键词:「PHP高性能开发实战」

方案
平均响应时间
P99
QPS
CPU 使用率
MySQL LIKE
4200ms
超时
12
95%
MySQL 全文索引
850ms
2300ms
60
78%
Elasticsearch35ms80ms140022%

结论:ES 比 MySQL LIKE 快 120 倍,QPS 提升 116 倍,且 CPU 使用率更低。

压测命令(Apache Bench):

ab -n 10000 -c 100 \
"http://localhost:8000/api/search?keyword=PHP%E9%AB%98%E6%80%A7%E8%83%BD&page=1"

七、生产环境避坑指南

坑一:分词不准导致召回率低

// ❌ 错误:建索引和搜索用同一个分析器
'analyzer' => 'ik_max_word',

// ✅ 正确:建索引用 ik_max_word(细),搜索用 ik_smart(准)
'analyzer'        => 'ik_max_word',   // 索引时
'search_analyzer' => 'ik_smart',      // 搜索时

坑二:深分页性能崩溃

// ❌ 深分页:from=9990, size=10 会扫描 10000 条
// 搜索第 1000 页时几乎和扫全表一样慢

// ✅ 方案一:限制最大页数(业务允许时最简单)
$page = min($page100);  // 最多翻到第100页

// ✅ 方案二:Search After(无限翻页的最优解)
$params['body']['search_after'] = [$lastScore$lastId];
$params['body']['sort']         = ['_score', ['id' => 'asc']];

坑三:大批量导入时分片不均

# 导入前关闭副本和刷新,速度提升 3~5 倍
curl -X PUT "localhost:9200/articles/_settings" -d'{
  "index": {
    "number_of_replicas": 0,
    "refresh_interval": "-1"
  }
}'


# 导入完成后恢复
curl -X PUT "localhost:9200/articles/_settings" -d'{
  "index": {
    "number_of_replicas": 1,
    "refresh_interval": "1s"
  }
}'

坑四:Mapping 不能随意修改

# ❌ 已有字段的 type 无法直接改(会报错)
# ✅ 解决方案:重建索引(Reindex API)

curl -X POST "localhost:9200/_reindex" -d'{
  "source": {"index": "articles_v1"},
  "dest":   {"index": "articles_v2"}
}'


# 用别名切换,零停机
curl -X POST "localhost:9200/_aliases" -d'{
  "actions": [
    {"remove": {"index": "articles_v1", "alias": "articles"}},
    {"add":    {"index": "articles_v2", "alias": "articles"}}
  ]
}'

坑五:内存不足导致 OOM

# docker-compose.yml:生产环境至少给 ES 分配 4G 堆内存
environment:
-ES_JAVA_OPTS=-Xms4g-Xmx4g# 堆内存 = 物理内存的 50%,且不超过 32G

八、质量检查清单

发布前必检 6 项:

  • 分词验证
    :对业务关键词调用 _analyze API 确认分词效果
  • 高亮测试
    :搜索结果中 <em> 标签正确包裹关键词
  • 分页正确
    :第1页、最后一页、超出范围页都测试过
  • 数据同步
    :新增/修改/删除文章后,ES 内数据在 2s 内同步
  • 性能压测
    :高并发场景下 P99 < 200ms
  • 异常处理
    :ES 服务挂掉时,降级到 MySQL 查询,不影响业务

九、总结

功能点
实现方案
中文分词
IK 分词器(ik_max_word 建索引 + ik_smart 搜索)
全文搜索
Multi Match + BM25 相关性评分
关键词高亮
ES 原生 Highlight API
搜索建议
match_phrase_prefix
聚合统计
Terms Aggregation
数据同步
Canal Binlog / Observer + Queue
深分页
Search After 游标分页

一句话总结:MySQL 是你的数据家园,Elasticsearch 是你的搜索引擎——让专业的工具做专业的事,PHP 只是连接它们的胶水,而这正是 PHP 最擅长的。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 05:08:50 HTTP/2.0 GET : https://f.mffb.com.cn/a/495965.html
  2. 运行时间 : 0.091349s [ 吞吐率:10.95req/s ] 内存消耗:4,533.34kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d9537a50392d322c3efc5c04362d86e8
  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.000491s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000688s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002495s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000289s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000485s ]
  6. SELECT * FROM `set` [ RunTime:0.000196s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000539s ]
  8. SELECT * FROM `article` WHERE `id` = 495965 LIMIT 1 [ RunTime:0.000522s ]
  9. UPDATE `article` SET `lasttime` = 1783026530 WHERE `id` = 495965 [ RunTime:0.007929s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000247s ]
  11. SELECT * FROM `article` WHERE `id` < 495965 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000457s ]
  12. SELECT * FROM `article` WHERE `id` > 495965 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000436s ]
  13. SELECT * FROM `article` WHERE `id` < 495965 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000836s ]
  14. SELECT * FROM `article` WHERE `id` < 495965 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000522s ]
  15. SELECT * FROM `article` WHERE `id` < 495965 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.006850s ]
0.093920s