What is the magento 2 equivalent of $_SERVER['QUERY_STRING']
I want to retrieve the full query string from the url and would like to do this using the framework's built in functions.
What is the magento 2 equivalent of $_SERVER['QUERY_STRING']
I want to retrieve the full query string from the url and would like to do this using the framework's built in functions.
I was able to achieve this using the getServer()
in the \Magento\Framework\HTTP\PhpEnvironment\Request
class
public function __construct
(
\Magento\Framework\HTTP\PhpEnvironment\Request $request,
)
{
$this->request = $request;
}
public function execute()
{
\Zend_Debug::dump($this->request->getServer('QUERY_STRING'));
die;
}
If no argument is set, $this->request->getServer()
will return complete $_SERVER
array