我有一个网站;我需要开发支持多种语言,例如 en、tr、ar、sp 等。
但问题是,使用 Codeigniter 实现此目的的最佳方法是什么?
我有一个 Controller (SITE)。我有很多功能,例如(酒店,城市,页面,博客)
我想在此方法之前添加一个段(语言)。这是旧链接
http://example.com/hotel/mariot
http://example.com/hotel/hilton
http://example.com/city/london
http://example.com/city/paris
...
..
我希望链接是这样的
http://example.com/en/hotel/mariot
http://example.com/ar/hotel/mariot
http://example.com/sp/hotel/mariot
http://example.com/tr/hotel/mariot
http://example.com/en/city/london
http://example.com/ar/city/paris
....
..
有时认为每种语言都有一个 Controller ,但这是可能的......
更改所有链接以支持语言的最佳方法是什么?
很抱歉,如果我的问题不清楚,这是我的英语。
最佳答案
正确的方法是使用routes.php在(application/config/routes.php)中查找
您可以使用正则表达式来解决您的特定问题。
这是手册:http://ellislab.com/codeigniter/user-guide/general/routing.html
关于php - 在 Codeigniter 中添加语言的 URI 段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14091171/