新浪云PHP环境设置允许跨域

在网站的根目录下加一个.htaccess文件,内容写

SetEnvIf Host "^(.*)$" AccessControlAllowOrigin=$0  
SetEnvIf Host "^(.*)$" Pro=http  
SetEnvIf X-FORWARDED-PROTO "https" Pro=https  
Header set Access-Control-Allow-Origin: "%{Pro}e://%{AccessControlAllowOrigin}e" env=AccessControlAllowOrigin  
Header set Access-Control-Allow-Methods: POST,GET,OPTIONS env=AccessControlAllowOrigin  
Header set Access-Control-Allow-Headers: Content-Type,Authorization,X-Requested-With,range  env=AccessControlAllowOrigin  
Header set Access-Control-Allow-Credentials: true  env=AccessControlAllowOrigin  
Header set Access-Control-Expose-Headers: Accept-Ranges,Content-Encoding,Content-Length,Content-Range  env=AccessControlAllowOrigin  

即可,加完效果如下: