我需要帮助
$.get(
"php-script.php",
{mybutton: "2"},
function(data)
{
if(data == "1")
{
$('#ausgabe').html('LED is currently on');
$('#state').val('1');
$('#ubergabe').val('LED ausschalten');
}
else
{
$('#ausgabe').html('LED is currently off');
$('#state').val('0');
$('#ubergabe').val('LED einschalten');
}
}
);
} , 100);
});
</script>
</head>
<body>
<input type = "text" id = "box1">
<p id = "ausgabe"></p>
<form action ="php-script.php" method = "post" target="steuerung">
<input type= "hidden" name= "state" >
<input type = "submit" name = "ubergabe">
</form>
</body>
PHP脚本
<?php
$para = $_GET["mybutton"];
exec("gpio -1 mode 26 in");
exec("gpio -1 mode 24 out");
if($para == 1)
echo stati();
if($para == 2)
Led_stat();
if(isset($_POST['state']))
{
$status = $_POST['state'];
if($status == 1)
exec("gpio -1 write 24 1");
else
exec("gpio -1 write 24 0");
}
function stati()
{
$status = exec("gpio -1 read 26");
return $status;
}
function Led_stat()
{
if(exec("gpio -1 read 24") == 1)
echo "1";
else
echo "0";
}
&GT;
当我按下&#34; Senden&#34;按钮我收到此错误消息&#34;注意:未定义索引:第2行&#34中/var/www/stati/php-script.php中的mybutton;
昨天我的节目工作正常,但今天它没有 这太烦人了