首页 > 其他分享 >自动刷新页面

自动刷新页面

时间:2022-10-29 18:00:32浏览次数:56  
标签:text 50px htmlCode 刷新 自动 margin 页面

void handleRoot() {   //处理网站目录“/”的访问请求   esp8266_server.send(200, "text/html", sendHTML(pinState));   }   /* 建立用于发送给客户端浏览器的HTML代码。此代码将会每隔5秒刷新页面。 通过页面刷新,引脚的最新状态也会显示于页面中 */ String sendHTML(bool buttonState){      String htmlCode = "<!DOCTYPE html> <html>\n";   htmlCode +="<head><meta http-equiv='refresh' content='5'/>\n";     //每5秒自动刷新一次页面;   htmlCode +="<title>ESP8266 Butoon State</title>\n";   htmlCode +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";   htmlCode +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-bottom: 50px;}\n";   htmlCode +="</style>\n";   htmlCode +="</head>\n";   htmlCode +="<body>\n";   htmlCode +="<h1>ESP8266 BUTTON STATE</h1>\n";      if(buttonState)     {htmlCode +="<p>Button Status: HIGH</p>\n";}   else     {htmlCode +="<p>Button Status: LOW</p>\n";}        htmlCode +="</body>\n";   htmlCode +="</html>\n";      return htmlCode; }

标签:text,50px,htmlCode,刷新,自动,margin,页面
From: https://www.cnblogs.com/fengzhihean/p/16839281.html

相关文章