Table of Contents
ThinkPHP路由机制简介,thinkphp路由机制
您可能感兴趣的文章:
Home php教程 php手册 ThinkPHP路由机制简介,thinkphp路由机制

ThinkPHP路由机制简介,thinkphp路由机制

Jun 13, 2016 am 08:43 AM
thinkphp

ThinkPHP路由机制简介,thinkphp路由机制

本文实例讲述了ThinkPHP路由机制。分享给大家供大家参考,具体如下:

ThinkPHP 支持 URL 路由功能,要启用路由功能,需要设置ROUTER_ON参数为true。开启路由功能后,系统会自动进行路由检测,如果在路由定义里面找到和当前URL匹配的路由名称,就会进行路由解析和重定向。路由功能需要定义路由定义文件,位于项目的配置目录下面,文件名为 routes.php
定义格式:

Return Array(
 'RouteName'=>array('模块名称','操作名称','参数定义','额外参数'), 
 //常规路由
);

Copy after login

例如,我们启用了路由功能,并且定义了下面的一个路由规则:

'blog'=>array('Blog','index','year,month,day','userId=1&status=1')

Copy after login

那么我们在执行

复制代码 代码如下:http:///appName/blog/2007/9/15

的时候就会实际执行 Blog 模块的 index 操作,后面的参数/2007/9/15/ 就会依次按照 year/month/day 来解析,并且会隐含传入 userId=1 和 status=1 两个参数。

更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《ThinkPHP常用方法总结》、《smarty模板入门基础教程》及《PHP模板技术总结》。

希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。

您可能感兴趣的文章:

  • ThinkPHP路由详解
  • ThinkPHP、ZF2、Yaf、Laravel框架路由大比拼
  • thinkphp的URL路由规则与配置实例
  • 改写ThinkPHP的U方法使其路由下分页正常
  • thinkphp路由规则使用示例详解和伪静态功能实现(apache重写)
  • ThinkPHP的MVC开发机制实例解析
  • ThinkPHP使用Smarty第三方插件方法小结
  • thinkphp实现图片上传功能
  • thinkPHP查询方式小结
  • thinkphp命名空间用法实例详解
  • thinkPHP中分页用法实例分析
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

How to run thinkphp project

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

There are several versions of thinkphp

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

How to run thinkphp

How to install thinkphp How to install thinkphp Apr 09, 2024 pm 05:42 PM

How to install thinkphp

Which one is better, laravel or thinkphp? Which one is better, laravel or thinkphp? Apr 09, 2024 pm 03:18 PM

Which one is better, laravel or thinkphp?

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Nov 22, 2023 pm 12:01 PM

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks

ThinkPHP6 data encryption and decryption: protecting sensitive data security ThinkPHP6 data encryption and decryption: protecting sensitive data security Aug 25, 2023 pm 10:52 PM

ThinkPHP6 data encryption and decryption: protecting sensitive data security

ThinkPHP6 backend management system development: realizing backend functions ThinkPHP6 backend management system development: realizing backend functions Aug 27, 2023 am 11:55 AM

ThinkPHP6 backend management system development: realizing backend functions

See all articles