0

today I'm trying to pass an array from PHP to Python. I've looked around all the examples of passing soething from PHP to Python have all be all passing strings. When trying to 'recreate' what was done I get Notice: Array to string conversion in C:\xampp\htdocs\wrapper.php on line 7, and then no output. My PHP code is:

//$info is an array of values
exec("C:\Users\MrPete\AppData\Local\Programs\Python\Python38-32\python.exe C:\xampp\htdocs\test.py $info", $output, $return);
print_r($output);
echo '<br>';

and my python code is:

import sys



info = sys.argv[1]

for i in info:
    print (i)

I was wondering if someone could tell me what I'm doing wrong--and how to fix it.

Gfellha
  • 89
  • 5

0 Answers0