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

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

藏色散人
Release: 2023-03-10 19:04:02
Original
2608 people have browsed it

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;;
?>
Copy after login

Window close() method

Window Object Reference Manual Window object

Definition and usage

close() method is used to close the browser window.

Syntax

window.close()
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template