php实现用手机关闭计算机(电脑)的方法

适合有手机和电脑,用wifi的php web开发。方便关闭你的电脑(尤其在你想睡觉时 ),适合局域网

用法:放在你的web项目文件夹,可以新建立个目录

对了,把你的apache的httpd 或 iis 加入防火墙例外 ,文件是php后缀哦

<!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> <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" value="submit" /> </form> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/a8cad9539474fff4652156876673f256.html