Home >Backend Development >PHP Tutorial >PHP method to shut down the computer with a mobile phone_PHP tutorial
php method to use mobile phone to shut down computer (computer)
This example describes how to use PHP to shut down the computer (computer) using a 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 httpd or iis to the firewall exception. The file has a php suffix
?
2 3 11 12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<🎜>if($_POST){<🎜> <🎜>$shutdown = array(<🎜> <🎜>'shutdown' =>'shutdown -s -t 0',<🎜> <🎜>'restart' => 'shutdown -r',<🎜> <🎜>'logout' => 'shutdown -l',<🎜> <🎜>);<🎜> <🎜>$cmdk = $_POST['cmd'];<🎜> <🎜>echo $cmd = $shutdown[$cmdk];<🎜> <🎜>system($cmd); //Perform operation<🎜> <🎜>}<🎜> <🎜>?> |