1,如何讓Apache支援跨域存取呢?
步驟:
<code><span><</span>Directory <span>/</span><span>></span> AllowOverride <span>none</span><span>Require</span><span>all</span> granted <span>Header</span><span>set</span> Access<span>-Control</span><span>-Allow</span><span>-Origin</span><span>*</span><span><</span>/Directory<span>></span></code>
2,如何使Nginx支援跨域呢?
1,進入nginx的html目錄
vim ../crossdomain.xml
具體路徑: /usr/local/nginx/html/crossdomain.xml
<code><span><?xml version="1.0" encoding="UTF-8"?></span><span><!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"></span><span><<span>cross-domain-policy</span>></span><span><<span>allow-access-from</span><span>domain</span>=<span>"*"</span> /></span><span></<span>cross-domain-policy</span>></span></code>
以上就介紹了讓Apache 和nginx支援跨域訪問,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。