如何在Codeigniter 3中将GET方法形式的URL更改为斜杠 [英] How to change url of GET method form to slashes in codeigniter 3

查看:73
本文介绍了如何在Codeigniter 3中将GET方法形式的URL更改为斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到解决问题的方法,如果我的问题重复,请提供参考链接。所以我需要你的帮助
例如:

I can not find a solution to my problem, if my question is a duplicate, please provide a reference link. so I need your help. Here's for example:

localhost / ci / index.php / search /?song = sheila + on + 7

localhost/ci/index.php/search/?song=sheila+on+7

成为

localhost / ci / index.php / search / sheila_on_7

localhost/ci/index.php/search/sheila_on_7

localhost / ci / index.php / search / song / sheila_on_7

localhost/ci/index.php/search/song/sheila_on_7

谢谢。

推荐答案

CodeIgniter可选地支持此功能,可以在application / config.php文件中启用该功能。如果您打开配置文件,则会看到以下项目:

CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

如果将 enable_query_strings更改为TRUE,此功能将变为活动状态。然后,可以使用设置为调用控制器和方法的触发词来访问控制器和函数:

If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then be accessible using the "trigger" words you've set to invoke your controllers and methods:

index.php?c=controller&m=method

更多信息可在 CodeIgniter URL 用户指南

这篇关于如何在Codeigniter 3中将GET方法形式的URL更改为斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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