插件模板路由文件
在插件目录下创建route.php自定义路由文件
插件模板使用路由
以博客插件的文章分类为例:
~~~php
<?php
// +----------------------------------------------------------------------
// | 插件定义路由信息,当类型为分类时,会自动执行插入操作
// +----------------------------------------------------------------------
return [
[
"name" => "blog",
"route" => "blog/single",
"title" => "博客详情",
"table" => "app_blog",
"search" => ["status" => 1, "language" => ""],
"type" => "single",// 定义详情页路由,访问页面为域名/blog/1.html若seo_url为ceshi则域名/blog/ceshi.html
],
[
"name" => "blog-catalog",
"route" => "blog/catalog",
"title" => "博客分类",
"table" => "catalog",
"search" => ["type" => "blog", "status" => 1, "language" => ""],
"type" => "catalog", // 定义分类页路由,访问页面为域名/blog,系统会自动加载分页
],
[
"name" => "ceshi",
"route" => "blog/ceshi",
"title" => "博客测试",
"type" => "page", // 定义单页路由,访问域名/ceshi相当于加载域名/blog/blog/ceshi
],
];
~~~