导入请求:php中的python脚本

2024-09-27 18:06:56 发布

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

我只是在python脚本上遇到了一些问题,运行良好,但是现在我在脚本中添加了一行:“import requests”,它会向我发送错误:

'Message: Undefined offset: 0'

下面是如何在php中执行python的代码:

$lugar = $this->input->post('lugar');
$fecha = $this->input->post('fecha');
$colonia = $this->input->post('colonia');
$pais = $this->input->post('pais');
$num_ext = $this->input->post('num_ext');
$num_int = $this->input->post('num_int');
$localidad = $this->input->post('localidad');
$cp = $this->input->post('cp');
$rfc = $this->input->post('rfc');
$rfc_name = $this->input->post('rfc_name');
$estado = $this->input->post('estado');
$municipio = $this->input->post('municipio');
$calle = $this->input->post('calle');

exec("python listo.py '".escapeshellarg($lugar)."' '".$fecha."' '".$colonia."' '".$pais."' '".$num_ext."' '".$num_int."' '".$localidad."' '".$cp."' '".$rfc."' '".$rfc_name."' '".$estado."' '".$municipio."' '".$calle."'",$salida);
echo $salida[0];

问题是我需要请求发送我的json:

^{pr2}$

Tags: nameinputrfcthispostcpnumext

热门问题