drupal_query_string_encode
includes/common.inc, строка 213
- Версии
- 5 – 6
drupal_query_string_encode($query, $exclude = array(), $parent = '')
Parse an array into a valid urlencoded query string.
Параметры
$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
Возвращаемое значение
urlencoded string which can be appended to/as the URL query string
Код
<?php
function drupal_query_string_encode($query, $exclude = array(), $parent = '') {
$params = array();
foreach ($query as $key => $value) {
$key = drupal_urlencode($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 .'='. drupal_urlencode($value);
}
}
return implode('&', $params);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии