This article mainly introduces the method of using PHP to shut down the computer using a mobile phone. It involves the related skills of PHP using the system method to call system commands. Friends in need can refer to the following.
The example of this article tells about the PHP method of using a mobile phone to implement it. Ways to shut down your computer. The specific analysis is as follows:
It is suitable for php web development with mobile phones and computers and using wifi. Convenient to shut down your computer (especially when you want to sleep), suitable for local area network
Usage: Place it in your web project folder, you can create a new directory
By the way, put your Apache httpd or iis add firewall exception, the file is php suffix
<!DOCTYPE html> <html lang="zh-CN"> <head> <title>computer-manager</title> </head> <body> <p> <?php if($_POST){ $shutdown = array( 'shutdown' =>'shutdown -s -t 0', 'restart' => 'shutdown -r', 'logout' => 'shutdown -l', ); $cmdk = $_POST['cmd']; echo $cmd = $shutdown[$cmdk]; system($cmd); // 执行操作 } ?> </p> <form action="#top" method="post"> <p>choose you want.</p> <select name="cmd"> <option value="shutdown" selected="selected"> shutdown/ go to sleep. </option> <option value="restart"> restart computer/ ok, if no password. </option> <option value="logout"> logout/ you don't want this. </option> </select> <input type="submit" name="submit" value="submit" /> </form> </body> </html>
##Summary: The above is this The entire content of this article is hoped to be helpful to everyone's study.
Related recommendations:
A brief description of the magic methods provided in PHP
PHP output buffering Introduction and function
Basic knowledge of PHP streams
# #
The above is the detailed content of How to shut down computer using mobile phone in php. For more information, please follow other related articles on the PHP Chinese website!