当前位置: 首页 > news >正文

衡阳网站定制cdr做图时怎么找到网站的

衡阳网站定制,cdr做图时怎么找到网站的,打开百度,做一个网站的基本步骤之前测试功能写过一次#xff0c;因为代码忘记保存#xff0c;导致真正用到的时候怎么也想不起来当初怎么写的了#xff0c;复现后还是写个文章记录一下#xff0c;省的下次再忘记。 php后端 /*** 图片保存到本地*/ public function uploadLocalImage() {try {$img $thi…之前测试功能写过一次因为代码忘记保存导致真正用到的时候怎么也想不起来当初怎么写的了复现后还是写个文章记录一下省的下次再忘记。 php后端 /*** 图片保存到本地*/ public function uploadLocalImage() {try {$img $this-_request-file(img);if (empty($img)) {throw new \Exception(缺少图片参数);}$writeDir images/.date(Ymd);$dir D:/phpstudy_pro/WWW/vkm_locarun_dist/dist/.$writeDir;//$dir local_run/ . date(Ymd); //linux调试地址if (!file_exists($dir)) {mkdir($dir, 0777, true);}$extension substr($img-getMimeType(), -3);if ($extension bmp) {$fileName UtilService::createOrderNo() . .bmp;}if ($extension png) {$fileName UtilService::createOrderNo() . .png;}else{$fileName UtilService::createOrderNo() . .jpg;}$imgContent file_get_contents($img);file_put_contents($dir . / . $fileName, $imgContent);$localhostImg env(CLIENT_URL) . $writeDir . / . $fileName;//http://127.0.0.1:8000/xxx/20231016/xxx.jpg 读取方式$this-returnSuccess($localhostImg);} catch (\Exception $e) {$this-returnFault($e-getMessage());} }Unity C# /// summary /// 上传文件到服务器 /// /summary /// param namefilePaths文件路径/param void UploadToLocalServer(string[] filePaths) {int count filePaths.Length;urls new string[count];isUploaded new bool[count];string filePath;//文件命为上传OSS时的keyfor (int i 0; i count; i){int current i;filePath filePaths[current];if (File.Exists(filePath)){File.SetAttributes(filePath, FileAttributes.Normal);StartCoroutine(UploadToLocal(filePath, current));}else{urls[current] none;}} } IEnumerator UploadToLocal(string filePath, int index) {byte[] fileByte File.ReadAllBytes(filePath);WWWForm form new WWWForm();//根据自己上传的文件修改格式,img是接口请求json参数的key, //最后一个参数是图片的mimeType, 因为上传的图片有jpg、png、bmp几种格式此处取文件后缀和image组合字符串作为mimeTypeform.AddBinaryData(img, fileByte, Path.GetFileName(filePath), $image/{Path.GetExtension(filePath)});Helper.Log(${Config.SystemConfig.sendHost}/uploadLocalImage);using (UnityWebRequest www UnityWebRequest.Post(${Config.SystemConfig.sendHost}/uploadLocalImage, form)){yield return www.SendWebRequest();if (www.result UnityWebRequest.Result.ConnectionError || www.result UnityWebRequest.Result.ProtocolError){urls[index] error;Helper.LogError($[ERROR] {filePath}, msg: {www.error});}else{string text www.downloadHandler.text;//Helper.Log(服务器返回值 text);JObject json JObject.Parse(text);if (json[msg].ToString().Equals(success)){urls[index] json[data].ToString();Helper.Log($[SUCCESS] {urls[index]});}else{urls[index] error;Helper.LogError($[ERROR] {filePath}, msg: {text});}isUploaded[index] true;}} }搞定。
http://www.dnsts.com.cn/news/110369.html

相关文章:

  • 电子商务网站用什么语言开发扬州网站建设兼职
  • 济南网站建设流程郑州网站建设讯息
  • 酒店网站案例菏泽做网站电话
  • 公众号如何推广宣传网站优化有什么用
  • 做视频网站视频用什么插件做网站的公司是什么
  • 全球电子商务网站排名网站广告案例
  • 网站建设的行业资讯qq空间注册申请
  • 建筑公司网站关键词有哪些李贤威wordpress
  • 台州汇客网站建设优化网站标题是什么意思
  • django做的网站模板网站建设专家有哪些
  • 哈尔滨模板建站推荐网络营销网站平台有哪些
  • 网站备案 类型手机浏览器输入网址
  • 辽宁省城乡建设网站营销型网站建设就找山东艾乎建站
  • 综合性电子商务网站有哪些河北保定刚刚发布的紧急通知
  • 百度不收录网站怎么办百度网页版在线使用
  • 知名建设网站建网站是什么专业类别
  • 建设网站的网站叫什么网页制作基础教程简介
  • 西安市做网站公司pc 手机网站源码
  • 英文公司网站设计wordpress qux主题
  • 河南seo网站开发网站建设制作设计营销 大连
  • 微信连接微网站咸阳做网站的公司
  • 宣城网站建设 有限公司建筑360网
  • 产品网站建设公司多媒体应用设计师好考吗
  • 如何搭建o2o网站手表网站排行榜
  • 网站编辑转做新媒体运营秘密入口3秒自动转接连接
  • 做设计网站赚钱吗一站式平台网站开发技术
  • 大丰企业做网站多少钱室内装修效果图大全2023图片
  • wordpress 整站东莞网站优化seo
  • flash制作网站的好处商业合作及运营方案
  • 医疗器械网站怎么做如何做网站登录界面