Angularjs http请求php

Angular js http request php

我正在尝试将 angular js 上的表单数据发送到 php 页面。但它不起作用。 这是我的表格:

这是我的 $http 请求

    nodes.controller("addNew",function($http){
    var  content = this;

    this.submitNew = function(type)
    {
        //content.body.filter
       $http({method:'POST',url:http+'nodes/create',

               data:{
                   title:content.title,
                   author:content.author,
                   node_author:content.node_author,
                   body:content.body,
                   type:type
               },
               headers:{
                   "Access-Control-Allow-Methods":"POST",
                   'Content-Type': 'application/x-www-form-urlencoded',
                   'Access-Control-Allow-Origin':'*',
                   "Access-Control-Allow-Headers": "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"
               }
           }

       );
        this.title = '';
        this.author = '';
        this.body = '';

    }
});

这个错误!!!

XMLHttpRequest cannot load http://hangoma.lc/nodes/create. Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers

header 详情

Remote Address:127.0.0.1:80
Request URL:http://hangoma.lc/nodes/create
Request Method:OPTIONS
Status Code:200 OK

求助!!!我找不到解决方案。

当您尝试从 127.0.0.1http://hangoma.lc/nodes/create 发出请求时。但是远程服务器不允许来自其他服务器的连接(http://hangoma.lc除外)。

您尝试连接的服务器应包含 access-control- headers。您不能根据您的要求强制这些。

This 问题有更多详细信息。