Hallo, ich habe ein python skript
1 | #!/usr/bin/python
|
2 | |
3 | def add(x,y): |
4 | """Gib x plus y zurueck.""" |
5 | return x + y |
6 | |
7 | |
8 | |
9 | print add(1,2) |
ich möchte nun dieses python-skript in php ausführen und den Wert in diesem Fall 3 zurücklesen und in eine variable speichern. Wie kann ich dies lösen?
1 | <?php
|
2 | $output = shell_exec('login.py'); |
3 | echo "<pre>$output</pre>"; |
4 | ?>
|
Danke