Home  >  Article  >  php教程  >  php用手机关计算机(电脑)

php用手机关计算机(电脑)

PHP中文网
PHP中文网Original
2016-05-25 17:06:261085browse

适合有手机和电脑,用wifi的php web开发。方便关闭你的电脑(尤其在你想睡觉时 ),适合局域网 
用法:放在你的web项目文件夹,可以新建立个目录 

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

1.php代码

<!DOCTYPE html>
<html>
<head>
    <title>computer-manager</title>
</head>
 
<body>
    <p>
 
    <?php
    if($_POST){
        $shutdown = array(
            &#39;shutdown&#39; =>&#39;shutdown -s -t 0&#39;,
            &#39;restart&#39; => &#39;shutdown -r&#39;,
            &#39;logout&#39; => &#39;shutdown -l&#39;,
        );
 
        $cmdk = $_POST[&#39;cmd&#39;];
        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&#39;t want this.</option>
        </select>
        <input type="submit" name="submit" value="submit" />
    </form>
</body>
</html>
Statement:
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