我想把数据从php发送到python

2024-04-20 08:18:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图将数据从php发送到python,我发现了一个来自here的教程。在

这是密码。在

菲律宾比索

<?php
$data = array('1','4','67','34');
$result = shell_exec('python try.py ' . escapeshellarg(json_encode($data)));
$resultData = json_decode($result, true)
var_dump($resultData);
?>

Python

^{pr2}$

和输出:

^{3}$

我试着成功了,但它只是一个整数,我想要一个字符串。在

我试着替换数据

$data = array('tiger','dog','cow','lion');

但结果是NULL


Tags: 数据pyjson密码datahere教程result