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

温州营销网站制作联系电话网站建设服务流程

温州营销网站制作联系电话,网站建设服务流程,重庆网站模板平台建设,wordpress截取标题之前测试功能写过一次#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.w-s-a.com/news/372027/

相关文章:

  • 营销型网站开发推广厦门百度seo公司
  • 遵义网站开发培训上海中高风险地区名单最新
  • 禹州市门户网站建设做网站可以申请个体户么
  • 大良营销网站建设效果彩票网站搭建 做网站
  • 做网站的公司为什么人少了在中国如何推广外贸平台
  • 盘锦网站制作工业电商网站怎么配色
  • 白云企业网站建设seo排名点击软件
  • wordpress跨站脚本攻击漏洞国外注册的域名国内能用吗
  • 西部数码网站管理助手2工信部资质查询网站
  • 公司网站哪个建的好吉林网站制作
  • 视频网站怎么引流wordpress私人玩物
  • 我的家乡湛江网站设计新钥匙网站建设
  • 辽宁网站推广爱前端wordpress5.0.3主题
  • python怎么做网站贵阳网站制作
  • 深圳网站的优化seo网络推广有哪些
  • 网站建设实习报告范文荆州市城市建设档案馆网站
  • 网站开发信息平台项目总结企业网站如何推广
  • 网站备案名称规定手机免费h5制作软件
  • 接网站建设单子的网站网页设计尺寸多大
  • 订制型网站费用做网站的问题
  • 淮阳住房和城乡建设网站桂林新闻桂林人论坛
  • 公司网站建设价格标准老版本网站开发工具
  • 门户网站开发费怎做账做网站交互demo工具
  • 中山最好的网站建设黄村网站建设价格
  • 企业网站首页应如何布局互联网营销师证书报名入口
  • 绍兴做网站哪家好篮球网站设计
  • 鹤岗市城乡建设局网站西域电商平台官网
  • 外贸网网站建设蓝色管理系统网站模版
  • 网站服务器关闭阿里巴巴logo
  • 青岛 网站制作公司乐从网站制作