Codeigniter URL question
I've been working with the awesome Codeigniter framework for PHP for a while. 开发者_Python百科Anyways, i've still got some questions.
It's easy to make an URL look like (domain.com/about) etc, but how can i make this combined with the news? something like domain.com/news/war/this_is_war etc? or maybe domain.com/war/123
Os there any good articles for this? Thanks anyway :)
With CI, a page
controller function function1(param1, param2)
corresponds to the URL domain.com/page/function1/param1/param2
, assuming you've configured .htaccess to get rid of the index.php
If you want specific url formats to load specific controllers/functions, you can configure your routing parameters in config/routes.php
- see this for more.
Take a look at this :
http://www.phpeveryday.com/articles/CodeIgniter-Getting-Parameters-From-GET-P151.html
I think it's what you are looking for.
The URI Class in CodeIgniter is probably best for handling this.
http://codeigniter.com/user_guide/general/controllers.html
http://codeigniter.com/user_guide/libraries/uri.html
It allows you to dissect the URI the person has entered (or linked to). You can then load content based on these parameters.
精彩评论