解决ajax post提交 跨域 cors问题

💡 原文中文,约200字,阅读约需1分钟。
📝

内容提要

本文介绍了解决ajax post提交跨域cors问题的方法。在nginx配置文件中加入以下两行代码即可解决问题。注意,要在nginx中加入这些头,在php文件中加是无效的。

🎯

关键要点

  • 介绍了解决ajax post提交跨域cors问题的方法。

  • 在nginx配置文件中加入add_header Access-Control-Allow-Origin *;和add_header Access-Control-Allow-Headers *;。

  • 注意:要在nginx中加入这些头,在php文件中加是无效的。

➡️

继续阅读