用Vendor调用php的扩展包

代码如下

                public function video(){
		// dump(file_get_contents('video/VodUploadSDK-PHP_1.0.2' . DIRECTORY_SEPARATOR . 'voduploadsdk' . DIRECTORY_SEPARATOR . 'Autoloader.php'));
		// exit();
		header("Content-Type:text/html; charset=utf-8"); //不然返回中文乱码
		$result   = array('state' => '失败', 'url' => '', 'name' => '', 'original' => '');
		// $sub_path = I('post.sfile', '', 'trim,htmlspecialchars'); //判断其他子目录
		$sub_path = 'video';
		$img_flag = empty($img_flag) ? 0 : 1;

		$yun_upload    = new \Common\Lib\YunUpload($img_flag, $sub_path);
		$upload_result = $yun_upload->upload();

		if ($upload_result['status']) {
			$result['state'] = 'SUCCESS';
			$result['info']  = $upload_result['data'];//成功
			//获取地址
			// dump($upload_result['data']);
			$filePath = $upload_result['data'][0]['url'];
			$accessKeyId = 'LTAIcs5GX95p0O2G';
			$accessKeySecret = 'TmodMCuN3NMgCC4y87IMbcW6JUPzdU';

			// require_once 'video/VodUploadSDK-PHP_1.0.2' . DIRECTORY_SEPARATOR . 'voduploadsdk' . DIRECTORY_SEPARATOR . 'Autoloader.php';
			// date_default_timezone_set('PRC');
				Vendor('VodUploadSDK.samples.uploadVideo');
				// echo '上传:'.$filePath;
				// testUploadWebVideo($accessKeyId, $accessKeySecret, 'http://anman.wxjoi.com'.$filePath);
				$url = testUploadLocalVideo($accessKeyId, $accessKeySecret, '.'.$filePath);
				
				if(strlen($url)>30){
					// 删除文件
					$path = '.'.$filePath;
					echo $url;
				}

				

		} else {
			$result['state'] = $upload_result['info'];
		}
		


	}


1679
主攻后端PHP
4660
二次开发Code
1679
长连接Swoole
4640
高并发网站Redis