更新图床工具

This commit is contained in:
net909
2025-07-14 12:45:47 +08:00
parent a449674739
commit affb5a3827
11 changed files with 182 additions and 232 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace plugin\utility\imghosting\api;
use Exception;
use plugin\utility\imghosting\api;
class baidu implements api
{
public function upload($filepath, $filename){
$url = 'https://wenku.baidu.com/user/api/editorimg';
$referer = 'https://wenku.baidu.com/';
$file = new \CURLFile($filepath);
$file->setPostFilename($filename);
$param = [
'file' => $file,
];
$cookie = 'BDUSS=3plTHA0aHpRNGI3MmIxTkpmNVpWTTYtLXpVWjlaRjdRQzFsNmxQNlNufkRiWGhvSVFBQUFBJCQAAAAAAAAAAAEAAAB5WXC40tfDzsTPs8cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMPgUGjD4FBoS';
$data = get_curl($url,$param,$referer, $cookie);
$arr = json_decode($data,true);
if(isset($arr['link'])){
$imgurl = str_replace('.cdn.bcebos.com', '.bj.bcebos.com', $arr['link']);
return ['url'=>$imgurl];
}else{
throw new Exception('上传失败!接口错误');
}
}
}