zoukankan      html  css  js  c++  java
  • thinkphp5三种URL访问模式

    thp5 :URL路径格式:

    【1】path_info      /my/my/index

    【2】混合模式:即可以使用path_info,也可以使用路由模式,并不是对同一个操作方法。混和模式指的是:有两三个操作方法,一个使用path_info一个使用路由等

    【3】强制使用路由模式

    配置路由application/config.php

     

    如果开发标准的api建议开启url_route_must

    // 是否强制使用路由
    'url_route_must' => false, //默认不使用 

     

    项目www/zerg
    http://localhost/zerg/public/index.php/my/my/index
    如何简化路由
    【1】域名phpstuty站点域名管理添加域名omg.cn,修改hosts加上:127.0.0.1 omg.cn
    得到如下
    omg.cn/my/my/index
    【2】如何简化: 模块/控制器/操作方法:my/my/index
    在application/route.php注册路由


    路由传参:路由传参的目的就是为了在控制器的方法里边获得参数
    get的第一种传参
    get的第二种传参:URL后边加?号,名=参数值

    控制器方法中获得参数的方法有三种

    【1】参数获取得第一种方法:函数参数一一对应

    http://omg.cn/hello/123?name=wangpan

    【2】参数获取的第二种方法:use hinkRequest

    【3】使用助手函数inout('param.')

    inout('param.')获得所有参数值

    inout('param.name')获得name参数值

    
    
  • 相关阅读:
    Python内置函数(49)——isinstance
    Python内置函数(48)——__import__
    Python内置函数(47)——vars
    Python内置函数(46)——format
    Python内置函数(45)——ascii
    Python内置函数(44)——len
    Python内置函数(43)——type
    Python内置函数(42)——hash
    Python内置函数(41)——id
    Linux下redis常用命令
  • 原文地址:https://www.cnblogs.com/finddata/p/10893524.html
Copyright © 2011-2022 走看看