我试图将数据发送到 mysql,我收到了“SEND OK”,但我的数据库仍然是空的。可能是什么问题?我附上了AT命令的代码,以及esp-post.php的代码。
代码:
全选import board
import busio
import
time
import digitalio
y=busio.UART(board.TX, board.RX, baudrate=115200)
LED = digitalio.DigitalInOut(board.D13)
LED.direction = digitalio.Direction.OUTPUT
LED.value = True
y.write(b'AT\r\n')
time.sleep(2)
print(y.read())
y.write(b'AT+CIPSTART=\"TCP\",\"l2022.infinityfreeapp.com\",80'+b'\r\n')
time.sleep(3)
print(y.read())
string='GET /postdata.php?proba=15'
string2=' HTTP/1.1\r\n'
string3='Host: l2022.infinityfreeapp.com\r\n'
string4='Connection: close\r\n'
lng=len(string+string2+string3+string4)
y.write(b'AT+CIPSEND='+str(lng)+b'\r\n')
time.sleep(2)
print(y.read())
y.write(bytearray(string))
time.sleep(1)
y.write(bytearray(string2))
time.sleep(1)
y.write(bytearray(string3))
time.sleep(1)
y.write(bytearray(string4))
time.sleep(1)
time.sleep(10)
print(y.read())
y.write(b'AT+CIPCLOSE\r\n')
time.sleep(5)
print(y.read())
代码:
全选
$proba=($_GET['proba']);
require 'config.php';
$sql = "INSERT INTO testare(proba) VALUES('.$proba.')";
if($db->query($sql) === FALSE)
{ echo "Error: " . $sql . "
" . $db->error; }
echo "
";
echo $db->insert_id;
在此图像中,这 5 个条目是通过网络浏览器中的链接手动发送的。REPL中,所有AT命令,返回OK