Home  >  Article  >  Backend Development  >  What is the code to close the current web page in php

What is the code to close the current web page in php

藏色散人
藏色散人Original
2021-06-21 09:43:472535browse

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.

What is the code to close the current web page in php

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 &#39;<script>window.close();</script>&#39;;
?>

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn