如何使用PHP弹出警报消息框?

2022-08-30 04:03:39

如何使用PHP弹出警报消息框?


答案 1

你可以使用Javascript:

// This is in the PHP file and sends a Javascript alert to the client
$message = "wrong answer";
echo "<script type='text/javascript'>alert('$message');</script>";

答案 2

创建报警功能

<?php
alert("Hello World");

function alert($msg) {
    echo "<script type='text/javascript'>alert('$msg');</script>";
}
?>