kicaj
kicaj

Reputation: 2968

CakePHP get url params outside controller

Anybody know, how to get url array params outside controller (for example bootstrap.php)?

Upvotes: 0

Views: 771

Answers (1)

Oldskool
Oldskool

Reputation: 34857

CakePHP is still PHP at the end of the day, so you can use any valid PHP method to achieve this. Like:

if (!empty($_SERVER['QUERY_STRING'])) {
    // A querystring was set...
}

Or

$url = parse_url($_SERVER['REQUEST_URI']);
if (!empty($url['query'])) {
     // A querystring was set...
}

After that you can do anything else that you want to do.

Upvotes: 1

Related Questions