How to shut down computer using mobile phone in php

墨辰丷
Release: 2023-03-31 15:02:02
Original
1337 people have browsed it

This article mainly introduces the method of using PHP to shut down the computer using a mobile phone. It involves the related skills of PHP using the system method to call system commands. Friends in need can refer to the following.

The example of this article tells about the PHP method of using a mobile phone to implement it. Ways to shut down your computer. The specific analysis is as follows:

It is suitable for php web development with mobile phones and computers and using wifi. Convenient to shut down your computer (especially when you want to sleep), suitable for local area network

Usage: Place it in your web project folder, you can create a new directory

By the way, put your Apache httpd or iis add firewall exception, the file is php suffix

<!DOCTYPE html>
<html lang="zh-CN">
<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>
Copy after login

##Summary: The above is this The entire content of this article is hoped to be helpful to everyone's study.

Related recommendations:

A brief description of the magic methods provided in PHP

PHP output buffering Introduction and function

Basic knowledge of PHP streams

# #

The above is the detailed content of How to shut down computer using mobile phone in php. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!