如何将数据从PHP传递到Python?这是我的代码。PHP:
$data = 'hello';
$result = shell_exec('/home/pi/Python.py' .$data);
Python:
result = sys.argv[1]
print(result)
但是当运行python代码时,它会显示错误:
"IndexError: list index out of range"。
不知道为什么?它是否有其他代码用于将数据从PHP传递到python?
如何将一个值从php传递给python
<?php $print_this = "hello world";
//pass it to python. then echo it in here. "hello world";
?>
我将如何将变量的值从php传递给python,python将返回它,php将回显它。
import sys
import urllib
from BeautifulSoup import BeautifulSoup as BS
url = '''http://www.kumby.com/avata
我在PHP中创建了一个基本的路由器,没有太多关于如何编写普通PHP路由器的在线材料。下面是我目前的实现。基本上,每个请求都被重定向到index.php,然后使用类路由器将用户重定向到home.php或add.php。问题是如何将任何类型的变量从index.php传递给home.php或add.php?
<?php
//***********************
// Router class
//*********************
class router
{
public $req = [];
public $url = "";
public $
我需要传递一些PHP值给shell_exec函数,以便从我的服务器执行另一个带有这个值的$usertoken文件。
下面是我的代码:
<?php
$usertoken= array( $_GET['usertoken'] );
$findme = 'valid_device';
$pos = strpos($usertoken, $findme);
if ($pos === false) {
echo "The string '$findme' was not found in the string '$use
我正在使用嵌入在iFrame页面中的mail-data.php,在该页面中输入用户详细信息以供邮件使用。
是否可以根据从数据库检索的id将数据从payin.php (原始页)页传递到mail-data.php (iFrame)?
如何将数据从mail-data.php (iFrame)发布到另一个页面mail.php以执行mail函数?如果是,如何将数据从普通页面传递到iFrame页面?
我尝试使用iFrame页面中的表单操作到mail.php,但是我得到了显示的错误。
Not Acceptable
An appropriate representation of the r