当前位置: 首页 > news >正文

如何部署thinkphp网站网页生成器

如何部署thinkphp网站,网页生成器,免费定制网页,做网站销售电话术语有没有一种办法可以让我通过网页就能够实时查看远程电脑的程序运行情况呢?为此,我想到了利用python的Flask制作一个网页,然后通过cpolar,转变成一个互联网的网页,方便随时了解电脑的程序运行情况,比如百度网…

有没有一种办法可以让我通过网页就能够实时查看远程电脑的程序运行情况呢?为此,我想到了利用python的Flask制作一个网页,然后通过cpolar,转变成一个互联网的网页,方便随时了解电脑的程序运行情况,比如百度网盘下载多少文件了,python数据处理是否完成等等。

1.flask服务端:

# -*- coding: utf-8 -*-
"""
Created on Tue Jun 17 20:52:47 2025@author: YBK
"""from flask import Flask, render_template, send_file
import pyautogui
import os
import timeapp = Flask(__name__)@app.route('/')
def index():return render_template('jp.html')@app.route('/screenshot')
def take_screenshot():screenshot = pyautogui.screenshot()screenshot_path = os.path.join('static', 'screenshot.png')screenshot.save(screenshot_path)return send_file(screenshot_path, mimetype='image/png')@app.route('/switch_window')
def switch_window():pyautogui.hotkey('alt', 'tab')time.sleep(0.5)  # 等待窗口切换完成return 'OK'@app.route('/switch_window1')
def press_win_1():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('1')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_window2')
def press_win_2():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('2')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_window3')
def press_win_3():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('3')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_window4')
def press_win_4():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('4')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_window5')
def press_win_5():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('5')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_windowd')
def press_win_d():try:pyautogui.keyDown('win')time.sleep(0.1)  # 确保Win键按下pyautogui.press('d')pyautogui.keyUp('win')return 'OK'except Exception as e:print(f"操作失败: {str(e)}")return 'Err'@app.route('/switch_ct')
def switch_ct():pyautogui.hotkey('ctrl', 'tab')time.sleep(0.5)  # 等待窗口切换完成return 'OK'@app.route('/switch_csi')
def switch_csi():pyautogui.hotkey('ctrl', 'shift', 'i')time.sleep(0.5)  # 等待窗口切换完成return 'OK'
if __name__ == '__main__':app.run(host='127.0.0.1',debug=True,use_reloader=False)

2.放在templates的网页jp.html

<!DOCTYPE html>
<html>
<head><title>远程桌面控制</title><style>#image-container {width: 800px;height: 600px;border: 1px solid #ccc;margin: 20px auto;}#screenshot-img {max-width: 100%;max-height: 100%;}.button-container {text-align: center;margin: 20px;}button {padding: 10px 20px;margin: 0 10px;font-size: 16px;}</style>
</head>
<body><div class="button-container"><button id="screenshot-btn">截屏</button><button id="switch-btn">切换</button><button id="switch-btn1">Win+1</button><button id="switch-btn2">Win+2</button><button id="switch-btn3">Win+3</button><button id="switch-btn4">Win+4</button><button id="switch-btn5">Win+5</button><button id="switch-btnd">Win+D</button></div><div id="image-container"><img id="screenshot-img" src="" alt="截屏将显示在这里"></div><div class="button-container"><button id="switch-btnct">Ctrl+Tab</button><button id="switch-btncsi">Ctrl+Shift+I</button></div><script>document.getElementById('screenshot-btn').addEventListener('click', function() {fetch('/screenshot').then(response => response.blob()).then(blob => {const img = document.getElementById('screenshot-img');img.src = URL.createObjectURL(blob);});});document.getElementById('switch-btn').addEventListener('click', function() {fetch('/switch_window');});document.getElementById('switch-btn1').addEventListener('click', function() {fetch('/switch_window1');});document.getElementById('switch-btn2').addEventListener('click', function() {fetch('/switch_window2');});document.getElementById('switch-btn3').addEventListener('click', function() {fetch('/switch_window3');});document.getElementById('switch-btn4').addEventListener('click', function() {fetch('/switch_window4');});document.getElementById('switch-btn5').addEventListener('click', function() {fetch('/switch_window5');});document.getElementById('switch-btnd').addEventListener('click', function() {fetch('/switch_windowd');});document.getElementById('switch-btnct').addEventListener('click', function() {fetch('/switch_ct');});document.getElementById('switch-btncsi').addEventListener('click', function() {fetch('/switch_csi');});</script>
</body>
</html>

3.记得新建static文件夹在py程序的同个文件夹中。

4.使用cmd,运行cpolar http 5000

5.python提取cpolar公网地址,也就是4上面显示的网址,发送给你的微信。(用另外一个微信在服务器登录)

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 22 11:17:27 2025@author: YBK
"""import requests
from bs4 import BeautifulSoup
import sys
import pyperclip
from wxauto import *
wx = WeChat()
who = '你的微信名'
# 登录网站并获取页面内容
def fetch_info_from_website(login_url, info_url, credentials, tunnel_name):with requests.Session() as session:try:# 获取登录页面以抓取csrf tokenlogin_page = session.get(login_url)login_page.raise_for_status() # 检查请求是否成功login_page_soup = BeautifulSoup(login_page.text, 'html.parser')# 提取csrf tokencsrf_token = login_page_soup.find('input', {'name': 'csrf_token'})['value']credentials['csrf_token'] = csrf_token# 登录print("登录中,请等待。")login_response = session.post(login_url, data=credentials)# 检查是否登录成功if login_response.status_code != 200 or login_response.url == login_url:print("登录失败,请检查您的凭据。")return []else:print("登录成功。")# 获取信息页面response = session.get(info_url)response.raise_for_status()# 解析页面soup = BeautifulSoup(response.text, 'html.parser')table = soup.find('table')if not table:print("未找到隧道列表,请检查对应设备的cpolar服务和网络连接。")return []links = [] # 用于存储找到的链接for row in table.find_all('tr')[1:]: # 跳过表头cells = row.find_all('td')if len(cells) > 1:tunnel = cells[0].get_text().strip()url_cell = row.find('a', href=True) # 直接在行中查找<a>标签if tunnel == tunnel_name and url_cell:links.append(url_cell['href']) # 添加匹配的链接print(f"找到隧道 {tunnel} 的链接: {url_cell['href']}")return linksexcept requests.RequestException as e:print(f"请求异常: {e}")except Exception as e:print(f"发生错误: {e}")
if __name__ == '__main__':login_url = "https://dashboard.cpolar.com/login"info_url = "https://dashboard.cpolar.com/status"credentials = {'login': '你的账号','password': '你的密码'}# 检查是否有命令行参数传入# if len(sys.argv) > 1:#   tunnel_name = sys.argv[1] # 第一个命令行参数作为隧道名称# else:#   print("请提供一个隧道名称作为参数,或者留空以自动提示输入。")#   tunnel_name = input("请输入隧道名称: ")#   if not tunnel_name:#     print("隧道名称不能为空。")#     sys.exit(1)tunnel_name = 'default'links = fetch_info_from_website(login_url, info_url, credentials, tunnel_name)if links:print(links[0])message = links[0]wx.SendMsg(message, who)pyperclip.copy(links[0])else:print(f"没有找到名为 {tunnel_name} 的隧道链接。")

运行界面:

PS:为了查看我的Spyder中程序的控制台,我加上了Ctrl+Tab和Ctrl+Shift+i,每一次按后都要按一下截屏,才会显示。

 


文章转载自:
http://dinncogimlety.stkw.cn
http://dinncoyen.stkw.cn
http://dinncomfa.stkw.cn
http://dinncolambrequin.stkw.cn
http://dinncoaccoutrement.stkw.cn
http://dinncogingivitis.stkw.cn
http://dinncoperoration.stkw.cn
http://dinncosponge.stkw.cn
http://dinncoglomera.stkw.cn
http://dinncomismanage.stkw.cn
http://dinncopiscicultural.stkw.cn
http://dinncowoorali.stkw.cn
http://dinncoveinule.stkw.cn
http://dinncouneasily.stkw.cn
http://dinncoobi.stkw.cn
http://dinncodrunken.stkw.cn
http://dinncofart.stkw.cn
http://dinncoundervaluation.stkw.cn
http://dinncorarely.stkw.cn
http://dinncougsome.stkw.cn
http://dinncofantasize.stkw.cn
http://dinncoambatch.stkw.cn
http://dinncodermoidal.stkw.cn
http://dinncointertrigo.stkw.cn
http://dinnconewton.stkw.cn
http://dinncoprepositive.stkw.cn
http://dinncoere.stkw.cn
http://dinncotrainset.stkw.cn
http://dinncovehicle.stkw.cn
http://dinncounstratified.stkw.cn
http://dinncodeemphasis.stkw.cn
http://dinncocomposedly.stkw.cn
http://dinncocanonry.stkw.cn
http://dinncodemarcation.stkw.cn
http://dinncokebob.stkw.cn
http://dinncomisguide.stkw.cn
http://dinncofwpca.stkw.cn
http://dinncorefutal.stkw.cn
http://dinncogrocer.stkw.cn
http://dinncofactualist.stkw.cn
http://dinncopaiute.stkw.cn
http://dinncodecohesion.stkw.cn
http://dinncohydroxytryptamine.stkw.cn
http://dinncomenstruation.stkw.cn
http://dinncoshadberry.stkw.cn
http://dinncohacendado.stkw.cn
http://dinncoaged.stkw.cn
http://dinncodjailolo.stkw.cn
http://dinncoeulogia.stkw.cn
http://dinncopandoor.stkw.cn
http://dinncolepidopterous.stkw.cn
http://dinncohispanic.stkw.cn
http://dinncoatonic.stkw.cn
http://dinncophenotype.stkw.cn
http://dinncocartouche.stkw.cn
http://dinncomtb.stkw.cn
http://dinncocanephora.stkw.cn
http://dinncosolicitude.stkw.cn
http://dinncoinspectorate.stkw.cn
http://dinncoironer.stkw.cn
http://dinncowaterlog.stkw.cn
http://dinncochiricahua.stkw.cn
http://dinncobosom.stkw.cn
http://dinncohaematinic.stkw.cn
http://dinncosomberly.stkw.cn
http://dinncotheme.stkw.cn
http://dinncomuscly.stkw.cn
http://dinncopycnometer.stkw.cn
http://dinncopaddler.stkw.cn
http://dinncotussar.stkw.cn
http://dinnconeuritic.stkw.cn
http://dinncoexosmosis.stkw.cn
http://dinncohelvetii.stkw.cn
http://dinncochili.stkw.cn
http://dinncoparamagnetic.stkw.cn
http://dinncoconsignable.stkw.cn
http://dinncoplumbing.stkw.cn
http://dinncoreindoctrinate.stkw.cn
http://dinncogadget.stkw.cn
http://dinncoyulan.stkw.cn
http://dinncotouchback.stkw.cn
http://dinncohandbag.stkw.cn
http://dinncosorghum.stkw.cn
http://dinncochromograph.stkw.cn
http://dinncoadoringly.stkw.cn
http://dinncomeliorable.stkw.cn
http://dinncoedo.stkw.cn
http://dinncoemotive.stkw.cn
http://dinncojohnston.stkw.cn
http://dinncobooted.stkw.cn
http://dinncocamphor.stkw.cn
http://dinncodirectional.stkw.cn
http://dinncotridentate.stkw.cn
http://dinncomisally.stkw.cn
http://dinncosvga.stkw.cn
http://dinncosarvodaya.stkw.cn
http://dinncocame.stkw.cn
http://dinncodependability.stkw.cn
http://dinncounsafe.stkw.cn
http://dinncodocility.stkw.cn
http://www.dinnco.com/news/147616.html

相关文章:

  • 响应式网站 做搜索推广缺点怎么制作一个网站
  • wordpress小程序插件百度seo排名360
  • 怎么查询网站是哪家公司做的做网站推广公司
  • b2c网站建设方案淘宝网官方网站
  • 网站开发与维护就业前景新闻摘抄大全
  • 绿色大气5.7织梦网站模版广告推广软件
  • 淮安网站排名优化公司微软bing搜索引擎
  • 涂料网站模板在线刷seo
  • 网站如何做生僻词引流百度指数如何分析数据
  • 网站文章做百度排名深圳十大教育培训机构排名
  • ps软件下载网站建立网站的详细步骤
  • 网络优化工程师发展前景陕西seo顾问服务
  • 做百度移动网站排名项目推广计划书
  • 做一个网站的建设过程网站制作模板
  • 网站备案有什么坏处灰色关键词排名代发
  • 龙岗网站推广有哪些免费网站可以发布广告
  • 临清住房建设网站seo基础理论
  • 网站建设 佛山google搜索引擎免费入口
  • 网站服务器租金当阳seo外包
  • 网站没有地图怎么做的中国seo谁最厉害
  • 长春网络公司营销模式seo范畴有哪些
  • 山东软件开发的公司seo经典案例
  • 安徽平台网站建设找哪家重庆seo整站优化方案范文
  • 网站规划怎么写怎么建个网站
  • 章丘做网站网络优化大师手机版
  • 想看外国的网站怎么做软件推广方案经典范文
  • 做网站单位百度地图推广怎么做的
  • 网站备案查询平台网络培训系统
  • 东阳建设网站百度app首页
  • 常用的网站建设技术有什么软件2022最新新闻素材摘抄