【问题标题】:Sending output of python to PHP webpage [duplicate]将python的输出发送到PHP网页[重复]
【发布时间】:2021-08-18 03:25:26
【问题描述】:

下面是我的 Python 代码。我的讲师要求我可以将 fanspeed.output['fan'] 发送到 PHP。例如,我在 xampp 上创建了一个网页,然后我需要将 python 的输出发送到网页,该网页将在网页上显示输出。我在网上搜索,我找不到解决它的工作方法。有人可以帮忙吗?

temp = int(input("temp="))
hum = int(input("hum="))
fanspeed.input['temperature'] = temp
fanspeed.input['humidify'] = hum
fanspeed.compute()
fanspeed.output['fan']
fan.view(sim=fanspeed)
print("Fan speed =",fanspeed.output['fan'])

【问题讨论】:

  • 这很有趣,我在谷歌上搜索了你的问题标题,得到了 1080 万次点击;来自这个网站的 38000 个...

标签: python php xampp


【解决方案1】:

最简单的方法是通过shell_exec调用python脚本。

类似的东西

<?php
echo shell_exec("python /path/to/your/python/script.py");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-10
    • 2021-11-02
    • 1970-01-01
    • 2023-03-30
    • 2023-03-18
    相关资源
    最近更新 更多