路由路由thinkcmf下route设置

php.ini里面需要把path_info打开(800行左右)
cgi.fix_pathinfo = 1

TAG:
$this->request->param(‘short’) 才能/demo/gu/short/short/xx (或/demo/gu/short?short=xx)获取信息
$this->request->get(‘short’) 只能/demo/gu/short?short=xx 获取信息

在/data/route/route.php 是全局路由

<?php
use think\facade\Route;


Route::rule('s/:short', 'demo/gu/short', 'GET')->pattern(['short' => '\w+']);

#此处将/s/xx 转到/demo/gu/short/short/xx (或/demo/gu/short?short=xx)

return [
    // 是否开启路由延迟解析
    'url_lazy_route'        => true,
    
    // 默认的路由变量规则
    'default_route_pattern' => '[\w\.]+',
    
    // 是否开启强制路由
    'url_route_must'        => false,
    
    // 合并路由规则
    'route_rule_merge'      => false,
    
    // 路由是否完全匹配
    'route_complete_match'  => false,
    
    // 去除斜杠
    'remove_slash'          => false,
];

此条目发表在None分类目录。将固定链接加入收藏夹。

发表回复