如何在警报器内部关闭后关闭窗口

Zai*_*ain 5 javascript php php-5.3

我需要在alertbox之后关闭窗口,我使用堆栈问题中提到的代码但我的警报框在PHP代码中,我收到警报框但是一旦我关闭它,窗口没有关闭,我是新的到PHP.代码如下,请帮帮我们

<?php 
$serial_get = trim(str_replace("(","",str_replace(")","",GetVolumeLabel("d"))));
 if ($serial_get == '1233-2AZ2'){ 
} 
else{
 echo '<script language="javascript">
window.alert("This is not a Licensed Software. Please contact IT Solutions.");
window.close()
</script>'; }?>
Run Code Online (Sandbox Code Playgroud)

Ikm*_*ani 1

你需要window.open(...)能够window.close()。您正在使用window.alert()。

请参阅链接中的最佳实践https://developer.mozilla.org/en-US/docs/Web/API/Window.open