메뉴 건너뛰기

XEDITION

Web

php에서 python script 실행하기

proin 2021.02.22 11:11 조회 수 : 1

http://sangyeop.iptime.org/wp/?p=266


 

1
2
3
4
5
6
7
8
9
10
<?php
 
echo "test<br>";
 
exec("python /python_script/test.py"$out$status);
 
echo $out[0]; 
echo $out[1];
?>
 
cs

 

1
2
3
4
test.py
print "hello, world!"
print "and this is 2nd line"
 
cs

 

Result

 

hello, world!

and this is 2nd line

 

 

 


 

 

 

 

 

위로