Can you help me with the following questions? How do I get:
Full / relative current URL
- / subdir / controller / action
- / subdir /
Full / Relative Application URL
I can use native php to get it but I think I should use COO functions.
How does any ideas work?
Thanks in advance thanks!
Tried to create a controller, which outputs all correctly I know that None of them are closed.
class controller_info controller {public function action_index () {$ uris = array ('page' = & gt; array ('a' = & gt; URL: base (right, wrong) request :: Example () -> Yuri (), 'B' => URL :: Base (right, wrong). Example: Example () -> Yuri (), 'C' = & gt; ; Url:: site (request :: example () -> URI ()), 'd' = URL :: site (request :: example () -> Yuri (), TRUE) ), 'Application' = & gt; array ('A' = & gt; URL :: base (), 'b' => URL :: base (true, true), 'c' => url : Site (), 'd' = & gt; ur L :: site (null, true););); $ This- & gt; Request-> Header ['content-type'] = 'text / plain'; $ This- & gt; Request-> Feedback = print_a ($ ur, true); } Public function action_version () {$ this- & gt; Request-> Feedback = 'Kohana Version:'. Kohna :: VERSION; } Public function action_php () {phpinfo (); Array ([page] = & gt; array ([A] => notification / index [b] = & gt;; ;;;;;;;;;;;;;;;;;;;;;;u; to ;;;;;;;;;;;;;;; ;;;;;;;;;;;; 2; ARA ([A] => ARA ([A] => / Kohana / [b] => http: // localhost / kohana / [ C] = & gt; / kohana / [d] = & gt; http: // localhost / kohana /))
Technically, this is actually the first page URL that That's a real relative URL, because all others start with either /
or http: //
.
Let me know the current page Need to get the URL, hence the URL category Decided to expand, think that I can share it here, tell me what you think :)
/ ** * Kohana URL extension extension * / Class URL Kohana_URL Extends the URL to the current request * * @ * Create the ultimate Bull absolute URL * @The Ultimate Bool Protocol and Domain (relative URL if ignored) * @ Return String * / Public Static Function On ( $ Full = fault, $ Protocol = false) {$ url = Request :: instance () - & gt; Uri (); If ($ full === true) $ url = self :: site ($ url, $ protocol); Return $ url; }} UCO URL :: ON (); // Controller / Action UCO URL :: ON (true); // / base_url / controller / verb echo url :: current (true, correct); // http: // domain / base_url / controller / action
Comments
Post a Comment