php - 如何将变量从python传递到php?
问题描述
我正在做一个项目,我在 python 中从 google sheet 读取数据。这里我将变量从 php 脚本传递给 python,然后在 python 中我正在做一些计算。现在我想将这些变量从 python 发送回 php 脚本。我怎么做 ?
username=sys.argv[1]
print(username)
for row in range(1,100):
if wks.cell(row,2).value== username:
n=row
break
print(n)
apti=0
if wks.cell(n,4).value == "1060":
apti+=1
if wks.cell(n,5).value == "20 yrs":
apti+=1
if wks.cell(n,6).value == "25":
apti+=1
if wks.cell(n,7).value == "250":
apti+=1
if wks.cell(n,8).value == "6":
apti+=1
if wks.cell(n,9).value == "12":
apti+=1
if wks.cell(n,10).value == "48":
apti+=1
if wks.cell(n,11).value == "1 and 2 only":
apti+=1
if wks.cell(n,12).value == "41":
apti+=1
if apti==9:
print('success')
else:
print ('Fail')
count=10
现在我想将 count 变量的值发送回 php 脚本
解决方案
欢迎来到 SO。我认为您正在使用 Google API 来读取单元格值并进行一些计算。我建议您将最终的我们的值写入工作表,然后尝试使用 php 接口从工作表中读取。因此,谷歌表充当您的数据库。
# At the end of python case, update sheet with final value
sheet.update_cell(...)
要使用 php 从更新的 google sheet 中读取,请参阅此处的文档:https ://developers.google.com/sheets/api/quickstart/php
希望这可以帮助 !
推荐阅读
- c# - 拦截控制器
- java - Android Studio FirebaseRecyclerAdapter 只过滤一次
- java - 休眠:保存一侧具有唯一约束的链接表
- python - 尽管安装了 Ansible 却找不到 boto3 和 botocore
- install4j - install4j:从 HTTP 请求中读取 XML
- python - 如何每次少打印一个字母?
- javascript - 如何在 Vue.js 中使用函数而不是 v-for 来访问数据?
- python-3.x - 错误:需要参数 -i/--image
- python - AttributeError:'str'对象在python pyQt中没有属性'set'错误
- node.js - Opsworks NodeJs 应用程序每 120 秒使用 SIGTERM 重启