本文实例讲述了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>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/789">
<img src="https://img.php.cn/upload/ai_manual/001/503/042/68b6d94942638283.png" alt="讯飞开放平台">
</a>
<div class="aritcle_card_info">
<a href="/ai/789">讯飞开放平台</a>
<p>科大讯飞推出的以语音交互技术为核心的AI开放平台</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="讯飞开放平台">
<span>152</span>
</div>
</div>
<a href="/ai/789" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="讯飞开放平台">
</a>
</div>
<p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</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>希望本文所述对大家的php程序设计有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号