drupal_basename

drupal_basename($uri, $suffix = NULL)

Gets the filename from a given path.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystem::basename().

Related topics

File interface
Common file handling functions.

File

core/includes/file.inc, line 1147
API for handling file uploads and server file management.

Code

function drupal_basename($uri, $suffix = NULL) {
  return \Drupal::service('file_system')->basename($uri, $suffix);
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.