当你想让一个按钮发送数据时,它必须是一个指定了操作和方法的表单,并且按钮必须是(大于)input type=submit。。。(小于)-如果您想基于表单数据做一些事情,必须有一个带值的命名元素,否则PHP在$ˉPOST中看不到它。在
//$status1 = trim(shell_exec("gpio -g read 12"));
$status="1";
if(isset($_POST['turnon'])){
// this is where you call your python or whatever when the status is already 1
$status="0";
}
if(isset($_POST['turnoff'])){
// this is where you call your python or whatever when status is already 0
$status="1";
}
if ($status==="1") {
echo "";
} else {
echo "";
}
?>
?>