Amp html 阻止表单提交到'';因为表格';s框架是沙盒和';允许表单';未设置权限

Amp html 阻止表单提交到'';因为表格';s框架是沙盒和';允许表单';未设置权限,amp-html,Amp Html,使用指南在AMP缓存中测试表单时,我在控制台中得到以下错误,但在域中没有得到 阻止表单提交到“”,因为表单的框架已沙盒化,并且未设置“允许表单”权限 形式 成功! 错误! form_post.php <?php if(!empty($_POST)) { $name = $_POST['name']; $email = $_POST['email']; $to = "*******.co.uk"; $subject = "Website Enquiry"; $t

使用指南在AMP缓存中测试表单时,我在控制台中得到以下错误,但在域中没有得到

阻止表单提交到“”,因为表单的框架已沙盒化,并且未设置“允许表单”权限

形式


成功!
错误!
form_post.php

<?php
if(!empty($_POST))
{
    $name = $_POST['name'];
    $email = $_POST['email'];

    $to = "*******.co.uk";
$subject = "Website Enquiry";
$txt = $name;
    $headers = array(
'From: ' . $email . '' ,
'Reply-To: ' . $email . '' ,
'X-Mailer: PHP/' . phpversion() ,
'MIME-Version: 1.0' ,
'Content-type: text/plain; charset="UTF-8"' 
 );
  $headers = implode( "\r\n" , $headers );

    /*/ this is the email we get from visitors*/
    $domain_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . 
   "://$_SERVER[HTTP_HOST]";

    /*//-->MUST BE 'https://';*/
    header("Content-type: application/json");
    header("Access-Control-Allow-Credentials: true");
    header("Access-Control-Allow-Origin: *.ampproject.org");
    header("AMP-Access-Control-Allow-Source-Origin: ".$domain_url);

    /*/ For Sending Error Use this code /*/
    if(!mail("rob@webifex.co.uk" , "Site Enquiry" , "email: $name <br/> 
   name: $name" , "From: $name\n ")){
        header("HTTP/1.0 412 Precondition Failed", true, 412);

        echo json_encode(array('errmsg'=>'There is some error while sending 
   email!'));
        die();
    }
    else
    {
        /*/--Assuming all validations are good here--*/
        header("Access-Control-Expose-Headers: AMP-Access-Control-Allow- 
   Source-Origin");   

    mail($to,$subject,$txt,$headers);

            echo json_encode(array('successmsg'=>$_POST['name'].'My success 
  message. [It will be displayed shortly(!) if with redirect]'));
        die();
    }
}?>

由于某种原因,错误消息消失了,但我留下了以下新错误

“Access Control Allow Origin”标头包含无效值“*.ampproject.org”。来源“article webiflex co uk.cdn.ampproject.org”;因此不允许访问


似乎使用wilcard*.ampproject.org'会产生这个错误,所以我已经替换了它,现在正在工作,

这个问题是关于什么的?这些与你正在做的事情有什么关系?这是关于使用amp表单以及为什么它在amp缓存中不起作用的问题听起来像是一个针对amp特定论坛或聊天室的问题,除非你能给我们提供一个最小的、自成体系的示例,我们可以测试它,任何人都可以猜测到底出了什么问题。表格提交给什么?从哪里来?我以为我是。。。用代码更新
<?php
if(!empty($_POST))
{
    $name = $_POST['name'];
    $email = $_POST['email'];

    $to = "*******.co.uk";
$subject = "Website Enquiry";
$txt = $name;
    $headers = array(
'From: ' . $email . '' ,
'Reply-To: ' . $email . '' ,
'X-Mailer: PHP/' . phpversion() ,
'MIME-Version: 1.0' ,
'Content-type: text/plain; charset="UTF-8"' 
 );
  $headers = implode( "\r\n" , $headers );

    /*/ this is the email we get from visitors*/
    $domain_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . 
   "://$_SERVER[HTTP_HOST]";

    /*//-->MUST BE 'https://';*/
    header("Content-type: application/json");
    header("Access-Control-Allow-Credentials: true");
    header("Access-Control-Allow-Origin: *.ampproject.org");
    header("AMP-Access-Control-Allow-Source-Origin: ".$domain_url);

    /*/ For Sending Error Use this code /*/
    if(!mail("rob@webifex.co.uk" , "Site Enquiry" , "email: $name <br/> 
   name: $name" , "From: $name\n ")){
        header("HTTP/1.0 412 Precondition Failed", true, 412);

        echo json_encode(array('errmsg'=>'There is some error while sending 
   email!'));
        die();
    }
    else
    {
        /*/--Assuming all validations are good here--*/
        header("Access-Control-Expose-Headers: AMP-Access-Control-Allow- 
   Source-Origin");   

    mail($to,$subject,$txt,$headers);

            echo json_encode(array('successmsg'=>$_POST['name'].'My success 
  message. [It will be displayed shortly(!) if with redirect]'));
        die();
    }
}?>