fix path = .

pull/2/head
sy-records 2020-04-12 10:03:14 +08:00
parent e9c4570d55
commit b03b51907c
1 changed files with 2 additions and 2 deletions

View File

@ -281,8 +281,8 @@ add_action('delete_attachment', 'oss_delete_remote_attachment');
// 当upload_path为根目录时需要移除URL中出现的“绝对路径” // 当upload_path为根目录时需要移除URL中出现的“绝对路径”
function oss_modefiy_img_url($url, $post_id) function oss_modefiy_img_url($url, $post_id)
{ {
$home_path = str_replace(array('/', '\\'), array('', ''), get_home_path()); // 移除 ./ 和 项目根路径
$url = str_replace($home_path, '', $url); $url = str_replace(array('./', get_home_path()), array('', ''), $url);
return $url; return $url;
} }