function drupal_encode_path

drupal_encode_path($path)

Encodes a Drupal path for use in a URL.

For aesthetic reasons slashes are not escaped.

Note that url() takes care of calling this function, so a path passed to that function should not be encoded in advance.

Parameters

$path: The Drupal path to encode.

Related topics

File

includes/common.inc, line 634
Common functions that many Drupal modules will need to reference.

Code

function drupal_encode_path($path) {
  return str_replace('%2F', '/', rawurlencode($path));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_encode_path/7.x