codeigniter 中的 _remap 函数
我试图在 codeigniter 中使用重映射功能,但它不起作用。我有一个名为 submit_me
的方法,我会在 URL 中的 submit-me
中对其进行转换。我读到我可以使用 _remap
函数,但不幸的是我无法使用它。
public function _remap($method)
{
if($method == 'submit-me')
{
$this->submit_me();
}
else
{
$this->index();
}
}
这是正确的用法吗?
I'm trying to use remap function in codeigniter but it doesn't work. I have a method called submit_me
and I would transform it in submit-me
in the URL. I read I can use _remap
function but unfortunately I wasn't able to use it.
public function _remap($method)
{
if($method == 'submit-me')
{
$this->submit_me();
}
else
{
$this->index();
}
}
this is the correct use of it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
_remap() 用于调用类别。
示例:
我正在为一家电视制作公司建立一个网站。需要一个部分来展示他们的作品。这些作品分为以下几类:纪实片、戏剧片、事件片、儿童片和合拍片。
控制器名称后面的 url 段会自动作为参数传递,
因为我使用的是 URI 语言类,所以我在这里使用了 segment(4),这会在控制器之前添加一个额外的段,所以通常 segment(3) 就可以了
_remap() is used for a call a category.
Example :
I’m building a website for a TV production company. A section was needed to showcase their productions. These productions fall into categories: factual, drama, events, kids and co-productions.
the segment of the url after the controller name is automatically passed as the argument
I use segment(4) here as I'm using the URI language class, which adds an extra segment before the controller, so usually segment(3) would be OK