如何使用 php 而不是 javascript 重定向到弹出窗口


How do you redirect to a popup using php and not javascript?

我在javascript中找到了很多方法,但我需要在php脚本中间调用smack。

<form action="" method="POST" target='popup' onsubmit="window.open('','popup','width=700,height=400,left=200,top=200,scrollbars=1')">
        Send a message  : <input type="text" name="twitmessage"><br>
        <input type="checkbox" name="twitter" value="My Posting Text">Would you like to send to Twitter?<br>
        <input type="checkbox" name="facebook" value="Stuff to Post to facebook">Would you like to post to Facebook?<br>
        <input type="submit" name="submit_cycle" value="Submit">
</form>
<?php
session_start();
// store session data
$_SESSION['twitmessage'] = $_POST['twitmessage'];
if(isset($_POST['submit_cycle'])) {
        if($_POST['twitter']){
                header("location: ../index.php?p=members");
        }
        if($_POST['facebook']){
                header("location: ../index.php?p=paybill");
        }else{
                echo "Something bad happened";
        }
}
?>

另一种方法。也许我没有正确理解你的意图。

要在其他窗口中打开Twitter对话框,您只需将target=_blank添加到表单中即可。

其余的应与上述相同。

若要创建大小窗口,请创建一个新的命名窗口。然后缩放它并将窗体的目标设置为窗口的名称。

你不能。

打开窗口是客户端操作,无法使用 PHP 执行。这是原则上的。

您可以生成 JS,这将在客户端打开一个新窗口。

<script>
    window.open('<?php echo htmlentities($url); ?>')
</script>