Cross-domain problem, my website can already be accessed, but it needs to be cross-domain. Baidu only told me that the origin site is set to: Access-Control-Allow-Origin: *
I was very confused and searched online, and the simplest solution given was to add the above code, but I didn’t Do you know which php file to add to it? There are many php files under the wordpress file. Also, I am using a virtual host or other server files.
The files under webroot are too I really hope someone can help me and make it as simple as possible. I am basically a novice when it comes to coding, and I still don’t understand some basic tags of HTML
Anyway, how to add cross-domain code to which file
Ignore those boring people who step on you. Didn’t you clearly say that you are a novice? Set up a cross-domain header on a public php page (such as a configuration page)
Add a line to index.php in the root directory of the website:
People nowadays are so incompetent and their own level is not that good. They also like to give negative marks to others and express their condolences to the original poster.
You don’t even understand html, I suggest you learn the basics first.
Search on Baidu and set the header in php
Remember not to produce any output before the header is executed
Apache (.htaccess):
Nginx:
PHP: