javascript 如何在 PHP 中显示消息框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24009762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 01:59:01  来源:igfitidea点击:

How to show messagebox in PHP

javascriptphpmodal-dialog

提问by user3678823

I am new to PHP. I have to display a message box asking if new record is required or we can copy and modify an old record to the user while adding a new record. How can I do this? Please help.

我是 PHP 新手。我必须显示一个消息框,询问是否需要新记录,或者我们可以在添加新记录时向用户复制和修改旧记录。我怎样才能做到这一点?请帮忙。

回答by Realit?tsverlust

I usually use this for messageboxes:

我通常将它用于消息框:

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

Not the cleanest method, but usually works without problems.

不是最干净的方法,但通常没有问题。