Fuelphp - 文件扩展名

发布于 2024-11-16 13:02:49 字数 244 浏览 6 评论 0原文

我制作了一个名为 sitemaps 的控制器并具有 action_sitemap() ,但是如何告诉 Fuel 处理以下内容?:

http://site/sitemaps/sitemap.xml

以及使用相同的 action_sitemap() ?:

http://site/sitemaps/id.xml

其中 id 可以是传递的变量。

I made a controller named sitemaps and have action_sitemap() , but how do I tell fuel to handle the following?:

http://site/sitemaps/sitemap.xml

and the following using the same action_sitemap() ?:

http://site/sitemaps/id.xml

where id could be a passed variable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不念旧人 2024-11-23 13:02:49

只需使用路由,为您指向您选择的控制器方法的两者设置一条路由。

文档中解释了路由

在你的routes.php应用程序配置文件中添加类似的内容:

'sitemaps/sitemap\.xml' => 'sitemaps/sitemap',
'sitemaps/([0-9]+)\.xml' => 'sitemaps/sitemap/$1',

Just use routing, setup a route for both that you point to a controller method of your choosing.

Routing is explained in the docs.

Put something like this in your routes.php app config file:

'sitemaps/sitemap\.xml' => 'sitemaps/sitemap',
'sitemaps/([0-9]+)\.xml' => 'sitemaps/sitemap/$1',
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文