常用函数-sanitize_file_name()

0条评论

常用函数-sanitize_file_name()

说明

过滤文件名中的特定字符串。

删除所有字符串,只保留以空格、破折号以及时间隔开的字母数字式字符串,将所有字符串转换为小写状态。所有空格和下划线都被转换为破折号。将多个破折号转换为单一破折号。删除名称以破折号结尾的文件。

用法

<?php sanitize_file_name( $name ) ?>

参数

$string

(字符串)(必需)文件名称

默认值:None

返回的值

(字符串)

过滤后的文件名

示例

注释

修改记录

自2.1.0版本后

源文件

sanitize_file_name()位于 wp-includes/formatting.php中。

相关资源

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.