CodeIgniter中的不区分大小写路由 [英] Case Insensitive Routing in CodeIgniter

查看:615
本文介绍了CodeIgniter中的不区分大小写路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CodeIgniter的路由器中写了这个。

  $ route ['companyname'] =/ profile / 1 ; 

这很好用,但是当我在URL中键入CompanyName时,它不工作。这是因为大写字符。



我想让这个路由不区分大小写。

解决方案

只需添加表达式(?i)

此处示例:

$ route ['(?i)companyname'] =/ profile / 1; p>

I've written this in the CodeIgniter's routers.

$route['companyname'] = "/profile/1";

This is working fine but when I type "CompanyName" into the URL then it doesn't work. This is because upper case characters.

I want to make this routing case insensitive. Please suggest the best way.

解决方案

Just add expression "(?i)"
Here example:
$route['(?i)companyname'] = "/profile/1";

这篇关于CodeIgniter中的不区分大小写路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆