CodeIgniter 中英文搜索引擎:
返回列表 发帖
PHP
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| [url]www.your-site.com/who/what/where/[/url]
|
| You can optionally enable standard query string based URLs:
| [url]www.your-site.com?who=me&what=something&where=here[/url]
|
| Options are: TRUE or FALSE (boolean)
|
| The two other items let you set the query string "words" that will
| invoke your controllers and its functions:
| [url]www.your-site.com/index.php?c=controller&m=function[/url]
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
复制代码

在 config.php 里设置,$config['enable_query_strings'] = TRUE; 就可以使用 URL 参数了,下面两个选项是控制器用c=xxxx,控制器方法用m=xxxx,上面的注释说的也很清楚。
QQ: 49489680
MSN: zhaochang_tj AT hotmail DOT com

TOP

恩。。觉得两种url传参数的方式都不错。。。。

TOP

建议还是适用分段传递参数的方法,这样更好,适合SEO的胃口。

TOP

谢谢分享,收到了,继续加油
程序人生,你我相伴!

TOP

得考虑以后的REST。

TOP

嘿嘿 不错哦                  

TOP

跟JAVA的MVC实现起来还是挺像的,呵呵~

TOP

对CI的事务机制的实现更感觉兴趣,有空一定会看一下

TOP

总数怎么能用$id啊?

既然数据是存放在数据库中,总会有GRUD的操作吧?从中间删掉几条记录,你取的$id还能是总数吗?

TOP

感谢hex提供这么详细的教程

TOP

返回列表