【发布时间】:2015-01-08 17:30:56
【问题描述】:
我有一个带有 Apache 服务器的 Raspberry Pi (PHP5)。我有一个代码来控制我的中继模块,但 PHP 不执行 python 脚本。
这是代码:
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<?php
if (isset($_POST['LightON']))
{
exec("sudo python /home/pi/lighton_1.py");
}
if (isset($_POST['LightOFF']))
{
exec("sudo python /home/pi/lightoff_1.py");
}
?>
<form method="post">
<button class="btn" name="LightON">Light ON</button>
<button class="btn" name="LightOFF">Light OFF</button><br><br>
</form>
</html>
【问题讨论】:
-
也许你可以添加一些配置文件,否则几乎不可能说出你的问题是什么
标签: php python linux apache raspberry-pi