开发者

fuelphp - file extensions

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 actio开发者_开发技巧n_sitemap() ?:

http://site/sitemaps/id.xml

where id could be a passed variable.


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',
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜