How to get URL argument in Page body by PHP?

后端 未结 3 1922
死守一世寂寞
死守一世寂寞 2021-01-05 22:49

On a Drupal site, PHP code is enabled for Page body content. How can I get the argument and its value in PHP code? For example, I\'d like to get ref and 3

3条回答
  •  孤独总比滥情好
    2021-01-05 23:33

    You can use drupal_get_query_parameters() as follows:

    $params = drupal_get_query_parameters();
    
    if (isset($params['ref']) && is_numeric($params['ref'])) {
      var_dump(check_plain($params['ref']));
    }
    

提交回复
热议问题