Drupal: get parametro GET sanificado

    0

    0

    Andrea Pistarini

    The code retrieves the value of the "my_param" variable from the request object and sets it in the $my_param variable. The code then uses a filter to sanitize the value of "my_param" to make sure it is an integer.

    Library: Drupal

    $my_param = \Drupal::request()->query->get('my_param');
    $my_param = filter_input(INPUT_GET, 'my_param', FILTER_SANITIZE_NUMBER_INT); // o FILTER_SANITIZE_STRING, FILTER_SANITIZE_EMAIL...
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.