untrailingslashit

函数


untrailingslashit ( $string )
参数
  • (string)
    $string
    What to remove the trailing slashes from.
    Required:
返回值
  • (string) String without the trailing slashes.
定义位置
  • wp-includes/formatting.php
    , line 2782
引入
2.2.0
弃用

Removes trailing forward slashes and backslashes if they exist.

The primary use of this is for paths and thus should be used for paths. It is
not restricted to paths and offers no specific path support.

function untrailingslashit( $string ) {
	return rtrim( $string, '/' );
}