<?php
echo "<script language=\"JavaScript\">alert(\"你好\");</script>";
?>
或者
<?php
print "<script language=\"JavaScript\">alert(\"你好\");</script>";
?>

2. 如果需要php弹出对话框之后返回原来页面可以这么写

<?php
echo "<script language=\"JavaScript\">\r\n";
echo " alert(\"你好\");\r\n";
echo " history.back();\r\n";
echo "</script>";
exit;
?>
或者
<?php
print "<script language=\"JavaScript\">\r\n";
print " alert(\"你好\");\r\n";
print " history.back();\r\n";
print "</script>";
exit;
?>