1。跨域
代理服务器
img.src = "proxy.phy?anotherDomain.com/img.png
CORS
cross-origin resource sharing.see http://enable-cors.org/
In PHP
If you don't have access to configure Apache, you can still send the header from a PHP script. It's a case of adding the following to your PHP scripts:
<?php header("Access-Control-Allow-Origin: *");
For Apache
Apache can be configured to expose this header using mod_headers, this is enabled by default in Apache however you may want to ensure it's
enabled by running the following command:
a2enmod headers
To expose the header you simply add the following line inside <Directory>
, <Location>
, <Files>
or <VirtualHost>
sections, or within a .htaccess
file:
Header set Access-Control-Allow-Origin *