Home >Backend Development >PHP Tutorial >PHP implements the method of shutting down the computer (computer) using a mobile phone, PHP uses a mobile phone_PHP tutorial
The example in this article tells the php method of shutting down the computer (computer) with the mobile phone. Share it with everyone for your reference. The specific analysis is as follows:
Suitable for php web development with mobile phones and computers using wifi. Convenient to shut down your computer (especially when you want to sleep), suitable for LAN
Usage: Place it in your web project folder, you can create a new directory
By the way, add your apache's httpd or iis to the firewall exception. The file has a 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>
I hope this article will be helpful to everyone’s PHP programming design.