返回

PHP标头函数是否覆盖htaccess标头?

发布时间:2022-06-22 13:36:32 254
# 后端

在PHP中设置标题

header("Access-Control-Allow-Origin: https://www.example.com");
header("Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description");
    

在中设置标题.htaccess

SetEnvIf Origin ^(https?://.+\.(example|gstatic)\.com(?::\d{1,5})?)$   CORS_ALLOW_ORIGIN=$1
Header append Access-Control-Allow-Origin  %{CORS_ALLOW_ORIGIN}e   env=CORS_ALLOW_ORIGIN

Header set Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

Header merge  Vary "Origin"

我不想编辑.htaccess文件PHPheader()函数覆盖?

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像