如何在Kohana 3.x中使用破折号的网址

编程入门 行业动态 更新时间:2024-10-25 16:26:27
本文介绍了如何在Kohana 3.x中使用破折号的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要有一个网址,例如 example/controller/ my-page-with-dashes

I need to have a URL such as example/controller/my-page-with-dashes

如何在Kohana中使用网址?我试着创建一个控制器,并命名操作 myPageWithDashes 像在Zend框架,但没有工作。

How can I have such as URL in Kohana? I tried creating a controller and name the action myPageWithDashes like in the Zend Framework but that didn't work. Any idea how it should be done?

推荐答案

复制文件 system / classes / kohana / request / client / internal.php 到您的应用程序文件夹 - application / classes / kohana / request / client / internal.php 。然后从

Copy the file system/classes/kohana/request/client/internal.php to your application folder - application/classes/kohana/request/client/internal.php. Then change line 106 from:

$action = $request->action();

到:

$action = str_replace('-', '_', $request->action());

更多推荐

如何在Kohana 3.x中使用破折号的网址

本文发布于:2023-11-01 11:29:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549221.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:破折号   网址   如何在   Kohana

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!