drupal 8 $_GET
In Drupal 8, $_GET
is a superglobal variable that contains the query parameters from the URL. It is an associative array where the keys are the parameter names and the values are the corresponding values passed in the URL. You can access the value of a specific parameter by using its key in the $_GET
array.
For example, if the URL is http://example.com/page?param1=value1¶m2=value2
, you can access the values of param1
and param2
using $_GET['param1']
and $_GET['param2']
respectively.
Please note that it is important to sanitize and validate the values obtained from $_GET
before using them in your code to prevent security vulnerabilities such as SQL injection or cross-site scripting attacks.
Source: - Source 1