$input->queryStringClean() method

Return a cleaned query string that was part of this request, or blank if none

Note: it is recommended that you always specify $options with this method as the defaults may or may not be consistent with your needs.

Available since version 3.0.167.

Usage

// basic usage
$string = $input->queryStringClean();

// usage with all arguments
$string = $input->queryStringClean(array $options = []);

Arguments

NameType(s)Description
options (optional)array
  • values (array): Optional associative array of [name=value] to use in query string rather than current GET vars. (default=[])
    • overrides (array): Array of values to override or add to current request values. (default=[])
    • validNames (array): Only include query string variables with these names, and omit any others. (default=[])
    • maxItems (int): Maximum number of variables/items to include in the query string or 0 for no max. (default=20)
    • maxLength (int): Max overall length of returned query string or 0 for no max. (default=1024)
    • maxNameLength (int): Max length of any “name” in the “name=value” portion of a query string or 0 for no max. (default=50)
    • maxValueLength (int): Max length of any “value” in the “name=value” portion of a query string or 0 for no max. (default=255)
    • maxArrayDepth (int): Maximum depth for arrays, or 0 to disallow arrays. (default=0)
    • maxArrayItems (int): Maximum number of items allowed in arrays or 0 for no max. (default=20)
    • associative (bool): Allow associative arrays? (default=false)
    • sanitizeName (string): Sanitize query string variable names with this sanitizer method or blank to ignore. (default='fieldName')
    • sanitizeValue (string): Sanitize query string variable values with this sanitizer method or blank to ignore. (default='line')
    • sanitizeRemove (bool): Remove any variables from query string that are changed as the result of sanitization? (default=true)
    • entityEncode (bool): Should returned query string be entity encoded for HTML output? (default=true)
    • encType (int): Use PHP_QUERY_RFC3986 for spaces encoded to '%20' or PHP_QUERY_RFC1738 for spaces as '+'. (default=PHP_QUERY_RFC3986)
    • separator (string): Character(s) that separate each “name=value” in query string. (default='&')

Return value

string


$input methods and properties

API reference based on ProcessWire core version 3.0.168

Twitter updates

  • There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new—More
    20 November 2020
  • ProcessWire 3.0.168 core updates — More
    26 October 2020
  • This week a 2nd new module for processing Stripe payments has been added to FormBuilder. Unlike our other Stripe Inputfield, this new one supports 3D Secure (SCA) payments. We’ll take a closer look at it in this post, plus a live demo— More
    16 October 2020

Latest news

  • ProcessWire Weekly #341
    In the 341st issue of ProcessWire Weekly we're going to check out the latest processwire.com blog post, introduce upcoming commercial module called NiftyPasswordsPlus, and check out a brand new site of the week. Read on!
    Weekly.pw / 21 November 2020
  • New ProcessWire modules directory
    There’s a new modules directory on the ProcessWire site now up and running. In this post we’ll cover a few details about what’s changed and what’s new.
    Blog / 20 November 2020
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits