plugin_dir()返回当前插件目录的绝对物理路径。用于require文件或读写文件。
// 引用插件内文件 require_once plugin_dir() . '/lib/helper.php'; // 读取配置文件 $config = json_decode(file_get_contents(plugin_dir() . '/config.json'), true); // 写入日志文件 file_put_contents(plugin_dir() . '/debug.log', $message . PHP_EOL, FILE_APPEND);