响应必须包含AMP-Access-Control-Allow-Source-Origin标头?

时间:2018-12-27 08:43:03

标签: php html forms amp-html

我在浏览器中遇到这些错误

  

“响应必须包含AMP-Access-Control-Allow-Source-Origin   标头”

  

”表单提交失败:错误:响应中必须包含   AMP-Access-Control-Allow-Source-Origin标头''

php

find . -group websites -type f -print0 | xargs -0 sh -c 'for f; do chgrp apache "$f"; chown apache "$f"; chmod 400 "$f"; done' _

html

<?php
if (isset($_POST['iletisimg'])) {
    $status = 0;
    $ip = $_SERVER['REMOTE_ADDR'];
    $time = time();
    if (empty($post->isim) || empty($post->mesaj) || empty($post->email)) {
        $yorumcevap = "Lütfen tüm alanları eksiksiz doldurunuz!";
    } else {
        $yorumekle = $db->query("insert into iletisim (isim,mesaj,email,konu,durum,tarih,ip) values ('$post->isim', '$post->mesaj', '$post->email', '$post->konu', 0, '$time', '$ip')");
        if ($yorumekle) {
            $yorumcevapok = "Teşekkürler. Talebiniz alındı.";
        } else {
            $yorumcevap = "Hata! Lütfen tekrar deneyin.";
        }
    }
}

如何对此进行编辑以避免这些错误?

1 个答案:

答案 0 :(得分:0)

您需要确保您的CORS设置符合here记录的AMP要求

还有一个类似的问题,其中提供了有关如何正确设置响应头的代码: AMP Access Control Allow Source Origin header Issue