<分区>
这是我的 PHP 代码。我希望使用警报窗口显示错误。
if ($projectid=="")
{
$error = 'You must choose a project.
Click ‘back’ and try again.';
include error.html.php';
exit();
}
这是应该被浏览器解析的error.html.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Script Error</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
var error = <?php echo $error ; ?>;
window.onload = function(){ alert(error); }
</script>
</body>
</html>
脚本标签怎么了?它们会阻止 PHP 运行吗?