今天在跨域使用ajax的时候浏览器报了这个异常
No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.
具体意思呢就是
在请求的资源上不存在’Access-Control-Allow-Origin’标头。因此不允许访问原点“null”。
看的懂也不知道解决方法,百度了,解决方法有很多,但始终没解决我这里的问题,
最后发现其实只需要在控制层加上这个注解就可以了
这个方法来自:
https://blog.csdn.net/tg928600774/article/details/80325040#commentBox
谢谢博主
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is there
最新推荐文章于 2023-12-10 16:34:27 发布