Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 谷歌驱动器保存按钮和带有标题的cors_Php_Google Drive Api_Cors - Fatal编程技术网

Php 谷歌驱动器保存按钮和带有标题的cors

Php 谷歌驱动器保存按钮和带有标题的cors,php,google-drive-api,cors,Php,Google Drive Api,Cors,我试图在我的网站上使用“保存到驱动器”按钮,但没有结果。单击按钮后,出现如下错误: *XMLHttpRequest cannot load http://myFILEsiteONE/file.doc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myMAINsiteTWO' is therefore not allowed access.* stacko

我试图在我的网站上使用“保存到驱动器”按钮,但没有结果。单击按钮后,出现如下错误:

*XMLHttpRequest cannot load http://myFILEsiteONE/file.doc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myMAINsiteTWO' is therefore not allowed access.*
stackoverflow对此有很多答案:所有问题都通过标题解决,这在google文档中有描述

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Range
Access-Control-Expose-Headers: Cache-Control, Content-Encoding, Content-Range
但是我的网站已经有了这个标题。获取php函数的结果如下:

array{
['0'] => string'HTTP/1.1 200 OK'
['1'] => string'Server: nginx'
['2'] => string'Date: Tue, 23 Dec 2014 13:41:52 GMT'
['3'] => string'Content-Type: text/html; charset=UTF-8'
['4'] => string'Content-Length: 1643'
['5'] => string'Connection: close'
['6'] => string'Vary: Accept-Encoding'
['7'] => string'X-Powered-By: PHP/5.3.3'
['8'] => string'P3P: policyref="/bitrix/p3p.xml", CP="NON DSP COR CUR ADM DEV PSA PSD OUR UNR BUS UNI COM NAV INT DEM STA"'
['9'] => string'X-Powered-CMS: Bitrix Site Manager (bc446669bda3fecf3857134c6da9af3b)'
['10'] => string'Set-Cookie: PHPSESSID=2ujm04isb6h1e3tk2ddonr4537; path=/; HttpOnly'
['11'] => string'Expires: Thu, 19 Nov 1981 08:52:00 GMT'
['12'] => string'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
['13'] => string'Pragma: no-cache'
['14'] => string'Set-Cookie: BITRIX_SM_GUEST_ID=256066; expires=Fri, 18-Dec-2015 13:41:12 GMT; path=/'
['15'] => string'Set-Cookie: BITRIX_SM_LAST_VISIT=23.12.2014+16%3A41%3A12; expires=Fri, 18-Dec-2015 13:41:12 GMT; path=/'
['16'] => string'Access-Control-Allow-Origin: *'
['17'] => string'Access-Control-Allow-Headers: Range'
['18'] => string'Access-Control-Expose-Headers: Cache-Control, Content-Encoding, Content-Range'
}
我只能通过FTP访问主机

我需要试试什么

p、 保存到磁盘从网站,在那里按钮放置-工作正常


多谢各位

由于您依赖于驱动器SDK,并且您拥有凭据,因此无法对访问控制标头使用原始通配符。您必须更改此源,才能将服务器地址指定为源