drupal_query_string_encode

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 drupal_query_string_encode($query, $exclude = array(), $parent = '')

Parse an array into a valid urlencoded query string.

Übergabeparameter

$query The array to be processed e.g. $_GET.

$exclude The array filled with keys to be excluded. Use parent[child] to exclude nested items.

$parent Should not be passed, only used in recursive calls.

Rückgabewert

An urlencoded string which can be appended to/as the URL query string.

▾ 6 functions call drupal_query_string_encode()

drupal_get_destination in includes/common.inc
Prepare a destination query string for use in combination with drupal_goto().
drupal_query_string_encode in includes/common.inc
Parse an array into a valid urlencoded query string.
pager_get_querystring in includes/pager.inc
Compose a query string to append to pager requests.
tablesort_get_querystring in includes/tablesort.inc
Compose a query string to append to table sorting requests.
theme_pager_link in includes/pager.inc
Format a link to a specific query result page.
url in includes/common.inc
Generates an internal or external URL.

Code

includes/common.inc, line 222

<?php
function drupal_query_string_encode($query, $exclude = array(), $parent = '') {
  $params = array();

  foreach ($query as $key => $value) {
    $key = rawurlencode($key);
    if ($parent) {
      $key = $parent . '[' . $key . ']';
    }

    if (in_array($key, $exclude)) {
      continue;
    }

    if (is_array($value)) {
      $params[] = drupal_query_string_encode($value, $exclude, $key);
    }
    else {
      $params[] = $key . '=' . rawurlencode($value);
    }
  }

  return implode('&', $params);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen