zoukankan      html  css  js  c++  java
  • thinkphp路由简介和设置使用

     

     

    use thinkRoute;
    //静态路由
    Route::rule('/', 'index/index/index');
    Route::rule('test', 'index/index/test');
    //带参数
    Route::rule('coure/:id', 'index/index/coure');
    
    //可选参数路由
    Route::rule('coure/:id/[:name]', 'index/index/coure');
    
    
    //完全匹配路由
    Route::rule('test1$', 'index/index/test1');
    
    //额外参数
    Route::rule('test2$', 'index/index/test2?id=1');
    
    //测试
    Route::rule('view', 'index/index/view');
    Route::rule('views', 'admin/index/view');

    //-----

    namespace appindexcontroller;
    
    class Index
    {
        public function index()
        {
    
            return "index";
        }
    
        //demo
        public function test()
        {
            return "我是用户自己";
        }
    
        public function coure()
        {
            echo input('id') . '' . input('name');
        }
    
        public function test1()
        {
            return "完全匹配路由";
        }
    
        public function test2()
        {
            dump(input());
            return "额外参数test2";
        }
    
        public function view()
        {
            return view();
        }
    }
  • 相关阅读:
    algorithm
    jstl
    jsp
    cookie
    变量和方法调用过程中会出现的参数传递
    http请求
    weblogic 的安全域问题
    web service
    行业充电
    客户端生成web service
  • 原文地址:https://www.cnblogs.com/xiaozhang666/p/11494117.html
Copyright © 2011-2022 走看看