plugin_basename()获取一个插件文件所在的目录路径

目录

描述

Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.

plugin_basename() 描述

用法

 <?php plugin_basename$file ); ?> 

plugin_basename() 用法

参数

$file

(string) (必填) Absolute path to a plugin file or directory within the plugins directory.

默认值: None

plugin_basename() 参数

注意

  • 使用到 both the WP_PLUGIN_DIR and WPMU_PLUGIN_DIR constants internally, to test for and strip the plugins directory path from the $file path. Note that the direct usage of WordPress internal constants is not recommended.

plugin_basename() 注意

历史

  • 添加于 版本: 1.5

plugin_basename() 历史

源文件

plugin_basename() 函数的代码位于 wp-includes/plugin.php.

plugin_basename() 源文件

相关