處理一個簡單的項目,我可以在瀏覽器的地址欄中輸入192.168.x.xx/?$n
,然後Raspberry Pi將發送一個等效於變量$n
的pwm信號(使用WiringPi庫) LED。我剛剛開始使用PHP,這就是爲什麼我需要幫助。現在我想到的是:使用PHP獲取用戶輸入
<?php
exec("gpio mode 1 pwm");
//declare $n as a variable (integer maybe)
//$n = the user input value from browser (I only know $_GET, pretty sure it's not this right?)
exec("gpio pwm 1 "+$n);
?>
將感謝任何幫助和指針。
http://www.w3schools.com/php/php_forms.asp – zwcloud