如何将所有XML扩展路由到特定方法codeigniter?

问题描述 投票:0回答:1

我有codeigniter项目。我希望通过控制器路由所有xml扩展URL。如果我的URL获得任何.xml扩展名,它将重定向特定的控制器方法(因为我必须检查一些东西),之后它将加载该.xml文件。所以我写

 $route['(.xml)'] = "home/xml";

它正确地将所有.xml文件重定向到home / xml方法,如果我的项目文件夹中不存在.xml文件。如果我的项目文件夹中存在.xml文件,则它不会触发/执行home / xml,它直接加载.xml文件。那我怎么能摆脱这个问题呢?提前致谢。

php xml codeigniter routing
1个回答
0
投票

你可以改变

$config['url_suffix'] = ''; 

$config['url_suffix'] = '.xml';

这是在你的config.php文件中

© www.soinside.com 2019 - 2024. All rights reserved.