iframe里面表单提交后如何跳出iframe重定向到另一个页面

if (isset($_POST['orderNo'])) {
    if (!empty($_POST['remark'])) {
        $form = "<form action=\"{$_POST['remark']}\" method=\"post\" target=\"_top\" id=\"resultForm\">";

        foreach ($_POST as $key => $val) {
            $form .= "<input name=\"{$key}\" type=\"hidden\" value=\"{$val}\" />";
        }

        $form .= "</form>";

        echo $form;
echo <<<SCRIPT
<script>
window.onload =function() {
    document.getElementById('resultForm').submit();
}
</script>
SCRIPT;

  form元素target属性给_top值

posted @ 2021-02-25 18:06  coder_xds  阅读(353)  评论(0编辑  收藏  举报