Home > Article > Backend Development > What is the code to close the current web page in php
The code for php to close the current web page is "window.close();", because PHP is a server-side language, and you must use the client-side language to close the browser window.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
php What is the code to close the current web page?
PHP is a server-side language. If you want to close the browser window, you need to use a client-side language, like Javascript.
The following is to use PHP to output a piece of JS to close the current browser window
<?php echo '<script>window.close();</script>'; ?>
Window close() method
Window Object Reference Manual Window object
Definition and usage
close() method is used to close the browser window.
Syntax
window.close()
All major browsers support the close() method
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What is the code to close the current web page in php. For more information, please follow other related articles on the PHP Chinese website!