我想我把我的网站搞砸了,这是我在其中一个页面上得到的一个错误
Warning : Cannot modify header information - headers already sent by (output started at /home/content/94/9066***/html/websites/{website name}.com/index.php:3) in /home/content/94/9066***/html/websites/{website name}.com/wp-includes/pluggable.php on line 896
我怎么才能摆脱这个?非
我的API满足来自其他来源的请求,因此我在.htaccess中设置了以下内容
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Content-Type,Accept"
Header always set Access-Control-Allow-Methods "GET,POST,PUT,DELETE,OPTIONS"
Header always set Access-Control-Expose-H
我有一个非常简单的timeoftheserver.php页面:
<?php
echo date('D, d M y H:i:s');
?>
在我的本地脚本上也很简单:
var today;
try {
today = new Date($.ajax({'type': 'HEAD', 'url': 'timeoftheserver.php'}).getResponseHeader('Date'));
}
catch(err) {
today = new Date();
a
我在服务器1上有一个由HTML/CSS/JS/JQUERY组成的网页。
在服务器2上,我有一个PHP文件来避免cors。
因此,我从服务器1请求到服务器2,然后使用cURL与我正在使用的API交互。
这个API发送回cookie,我想把它转发回服务器1(网站)。
我已经找了一段时间了,但我不知道该怎么做呢?
我猜这与捕获响应头有关吧?
任何帮助都会很好!我是PHP新手。
这里有更多信息:
// Here is how I am calling the server 2 file.
$.ajax({
URL:"HTTP://localhost......serve
我正在做一个ReactJS前端应用程序,并从一个用PHP创建的API中获取数据,但是我的反应是在localhost:3000上托管,但是我的php文件托管在localhost:80上。所以不知道如何写基尔,因为到目前为止,它总是有一些错误。我能知道怎么解决吗?谢谢。
错误:
Access to XMLHttpRequest at 'http://localhost/reacttest/src/api/read.php' from origin 'http://localhost:3000' has been blocked by CORS policy: No
仅当url不像"demo/secured“时才尝试删除cookie
在default.vcl中,我有:
sub vcl_fetch {
# error 200 req.url ~ ".*/demo/secured/.*";
if (req.url ~ ".*/demo/secured/.*") {
set beresp.http.x-whaaat = "this is demo securd";
}else {
unset beresp.http.set-cookie;
set b