How to set up cross domain in php

hzc
Release: 2023-03-01 14:06:02
Original
3747 people have browsed it

How to set up cross domain in php

Let’s first write an example without cross-domain:

$(document).ready(function(){ $.ajax({ type : "POST", url : "http://localhost/test8.php", }); });
Copy after login

Successfully responded to the message.

How to set up cross domain in php

How to set up cross domain in php

We write a special cross-domain example and change the domain name to 127.0.0.1:

$(document).ready(function(){ $.ajax({ type : "POST", url : "http://127.0.0.1/test8.php", }); });
Copy after login

Discover Cross-domain.

How to set up cross domain in php

How to set up cross domain in php

##We modify test8.php:

//允许所有地址跨域请求 header("Access-Control-Allow-Origin: *");
Copy after login

How to set up cross domain in php

How to set up cross domain in php

How to set up cross domain in php

Recommended tutorial: "

php tutorial"

The above is the detailed content of How to set up cross domain in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!