获取传入的插件__FILE__的文件系统目录路径(带斜杠)。
原型
plugin_dir_path( string $file )
参数
$file
(string)
(Required)
插件的文件名(FILE)。
返回值
(string)
包含该插件的目录的文件系统路径。
源文件
路径:wp-includes/plugin.php
<?php
...
function plugin_dir_path( $file ) {
return trailingslashit( dirname( $file ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/plugin_dir_path/