Kohana 3 - 获取 URL
你能帮我解决以下问题吗? 我如何获取:
绝对/相对当前网址
- http://www .example.com/subdir/controller/action
- /subdir/controller/action
绝对/相对应用程序 URL
- http://www.example.com/subdir/
- /subdir/
我当然可以使用本机 php 来获取它,但我认为我应该使用 ko3 函数。
知道这是如何运作的吗?
提前致谢!
could you help me with following questions.
How do i get the:
absolute/relative current url
- http://www.example.com/subdir/controller/action
- /subdir/controller/action
absolute/relative application url
- http://www.example.com/subdir/
- /subdir/
I could of course use native php to get it but i think i should rather use ko3 functions.
Any idea how that works?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试图制作一个能够正确输出它们的控制器。如果其中任何一个已关闭,请告诉我。
输出:
从技术上讲,实际上只有第一个页面 url 是真正的相对 url,因为所有其他页面都以
/
或http://
开头。需要自己获取当前页面的 url,因此决定扩展 url 类。我想我可以在这里分享。让我知道你的想法:)
Tried to make a controller that outputted them all correctly. Let me know if any of them are off.
Outputs this:
Technically speaking, it's actually only the first page url that is a real relative url, since all the others either start with
/
orhttp://
.Needed to get the url for the current page myself, so decided to extend the url class. Thought I could share it here. Let me know what you think :)
你不就是想说:
Kohana_Request::detect_uri() ?
Don't you just mean:
Kohana_Request::detect_uri() ?
绝对/相对当前 URL:
绝对/相对当前应用程序 URL:
希望有帮助
Absolute/Relative current URL:
Absolute/Relative current application URL:
Hope it helps