phpCORS rule to allow all origins to access page
if ( isset($_SERVER['HTTP_ORIGIN']) ) {
  header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
  header('Access-Control-Allow-Credentials: true');
}ctrl + c| $_SERVER['HTTP_ORIGIN']contains origin URL that requested our page | Access-Control-Allow-Originallow access to the origin passed (thus, all origins will be allowed) | 
| Access-Control-Allow-Credentialsalso enabling cookies and auth headers sharing | |
More of Php
- Call static method by variable name
- Disable notices ("Undefined variable", “Undefined index”, "Undefined offset”...)
- Request a URL with curl
- Enable errors display
- Get last element of array
- Delete an element from array by value
- Format number with leading zeros
- Get current URL
- Create directory recursively
- Check if string contains specific substring
See more codes...