问题 #416💬 已回答提出于 2017年10月13日作者 2uncle-code1 个反应

图片上传时出现了交叉原产问题

快速解答作者 2uncle-code1

嘿,大家抱歉这么晚回复。上周我接到公司另一个项目需要紧急更新。总之,你们提供的方案在我把文件移到同一个域后运行得很好。但如果你们有时间,请看看我们如何上传跨域状态的图片。提前感谢大家!👍

阅读下方完整回答 ↓

问题

我查了所有问题的历史,但没找到解决办法。 ![默认](https://user-images.githubusercontent.com/22438077/31529039-3c5a130e-b009-11e7-8db9-6a2eb600f337.png) 我改了这里,允许取源跨原点访问。 我的资产管理人没问题 ![默认](https://user-images.githubusercontent.com/22438077/31529078-846a613a-b009-11e7-95b0-c4f04914113e.png) 这是我的PHP代码 ![默认](https://user-images.githubusercontent.com/22438077/31529089-9900c09e-b009-11e7-9c09-734e7ba85282.png) 文件已上传成功 ![默认](https://user-images.githubusercontent.com/22438077/31529160-26994b38-b00a-11e7-994f-fd44ab306c9d.png) 但它会显示这些错误 ![默认](https://user-images.githubusercontent.com/22438077/31529127-e8b6221e-b009-11e7-8d0f-...

回答(3)

2uncle-code2017年10月24日

嘿,大家抱歉这么晚回复。上周我接到公司另一个项目需要紧急更新。总之,你们提供的方案在我把文件移到同一个域后运行得很好。但如果你们有时间,请看看我们如何上传跨域状态的图片。提前感谢大家!👍

mekamleshk2017年10月13日

你好@vtista

你的PHP代码应是这样的回复:

'[{“type”:“image”,“src”:“localhost/test/img/wechat.jpg”,“height”:350“,”weight“:250”}],'

尝试像这样去除斜线:

“回声json_encode($response,JSON_UNESCAPED_SLASHES);”

想了解更多参考,可以查看我的代码 [Here](https://github.com/artf/grapesjs/issues/393)

2uncle-code2017年10月13日

@mekamleshk 非常感谢,我照你说的做了,但问题依旧存在 ![默认](https://user-images.githubusercontent.com/22438077/31533328-3fbe2e16-b024-11e7-80f4-5fd8f6b2594f.png) ![默认](https://user-images.githubusercontent.com/22438077/31533250-0cde24a6-b024-11e7-87da-19904401352e.png) ![默认](https://user-images.githubusercontent.com/22...

相关问答

通过相似的问题讨论继续研究。

与此问题匹配的付费插件

根据问题关键词和标签相关性精选,助你更快交付。

查看全部插件

正在加载付费插件推荐……

免费方案

在以下平台查看开源 GrapesJS 插件: GitHub 或在我们的免费目录中快速搜索。

浏览免费插件 →
高级方案

高级插件提供支持、定期更新和生产就绪的功能——为你节省数天的集成工作。

浏览高级插件 →

相关教程

关于同一主题的深入指南。

全部教程 →

浏览插件分类

直接跳转到市场上的插件分类页面。