Form Cross domain POST request using PHP

后端 未结 3 1719
悲&欢浪女
悲&欢浪女 2021-01-03 10:40

I am trying to send data from a form to a php file so I can store it in a database, but its not working...

The code for the form is not on the same server as the php

3条回答
  •  失恋的感觉
    2021-01-03 11:14

    Add this at the beginning of your PHP file:

    header("access-control-allow-origin: *");
    

    More info on cross domain policy here.

提交回复
热议问题