jeudi 23 février 2017

Remove q=/search? from Query String in Laravel

I'm using OctoberCMS based on Laravel.

I'm trying to get the query string so I can parse it into variables.

It's putting q=/search? before the string and it won't parse.

It needs to be only what's after the question mark.

Page:

localhost:8888/search

Query:

localhost:8888/search?tags=galaxy

Results:

parse_str($_SERVER['QUERY_STRING']);

null

or

$queryString = getenv('QUERY_STRING');

q=/search?tags=galaxy 

or

$queryString = \Request:getQueryString();

q=%2Fsearch%3Ftags%3Dgalaxy 

Parse:

$tags = ''; 
parse_str($queryString);
echo $tags;

Solutions?

I tried using explode() on the "?" but I get an error when there is no query present. Undefined offset: 1.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mhONLM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire