我是Python的新手,
如何从PHP
调用python函数并将数组作为参数传递。
这是我到目前为止所做的,
$result = exec('C:\Python27\python.exe D:\wamp\www\python.py\get_player_list',$out);
echo var_dump($out);die;
我可以从PHP调用python文件,但我不知道如何调用函数并传递参数。
这是我的python.py文件:
def get_player_list(possible_name):
print 'test'
我有一个像这样的PHP数组:
Array
(
[0] => Array
(
[Player_Name] => Russell Westbrook
[position] => PG
[salary] => 11000
[point] => 53.47
)
[1] => Array
(
[Player_Name] => Chris Paul
[position] => PG
[salary] => 10200
[point] => 45.52
)
[2] => Array
(
[Player_Name] => Antonio
[position] => PG
[salary] => 10221
[point] => 43.52
)
)