在route.php中
return [ 'hello/:id' => 'index/Hello/index',];
Hello.php中
isGet()) echo "当前为 GET 请求"; if (request()->isPost()) echo "当前为 POST 请求"; }}
TP5解决了TP3中路由不能反转的问题,使用 url助手函数生成URL的时候用 url('index/Hello/index','id=1') 生成的地址 为 /hello/1
本文共 303 字,大约阅读时间需要 1 分钟。
在route.php中
return [ 'hello/:id' => 'index/Hello/index',];
Hello.php中
isGet()) echo "当前为 GET 请求"; if (request()->isPost()) echo "当前为 POST 请求"; }}
TP5解决了TP3中路由不能反转的问题,使用 url助手函数生成URL的时候用 url('index/Hello/index','id=1') 生成的地址 为 /hello/1
转载于:https://my.oschina.net/zhliang/blog/826464