添加到驱动类:
use Think\Upload\Driver\Dav\WDClient;
/**
* @describe webdav驱动类
* @author changliang.wu
* @date 2016-10-31
*/
class Dav {
private $config = array(
'host' => '', //服务器
'port' => 21, //端口
'username' => '', //用户名
'password' => '', //密码
);
private $error = ''; //上传错误信息
private $rootPath; //上传文件根目录
private $link; //WD链接
/**
* 构造函数,用于设置上传根路径
* @param array $config WD配置
*/
public function __construct($config){
/* 默认WD配置 */
$this->config = array_merge($this->config, $config);
/* 登录WD服务器 */
if(!$this->login()){
E($this->error);
}
}
/**
* 登录WebDav服务器
* @return boolean
*/
private function login() {
if ($this->link) {
return true;
}
$this->link = new WDClient();
$this->link->set_server($this->config['host&#