i18n友好版的basename()
原型
wp_basename( string $path, string $suffix = '' )
参数
$path
(string)
(Required)
一条路径。
$suffix
(string)
(Optional)
如果文件名以后缀结尾,则也将被截断。
返回值
(string)
源文件
路径:wp-includes/formatting.php
<?php
...
function wp_basename( $path, $suffix = '' ) {
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_basename/