Home php PHP Header ('Access-Control-Allow-Origin: *'); Where to accommodate

PHP Header (‘Access-Control-Allow-Origin: *’); Where to accommodate

Author

Date

Category

Where in the PCP file to place this command?

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

Need to contact PCP to contact over $ .post


Answer 1, Authority 100%

before the first contentual content. And where exactly depends on your architecture, framework, etc.

You can still use check:

if (! Headers_sent ()) {
   Header ('Access-Control-Allow-Origin: *');
} else {
   // error processing or notification developers
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions