I have a python script and a PHP script what I need is execute the python script through PHP and should get the return value of python code back to PHP.Here is my codes
<?php
$result1= passthru("python E:\naive-bayes-classifier-master\naiveBayesClassifier\return.py");
echo "return value is: $result1" . "\n";
?>
I execute this through another php script using a submit button
and here is the python code
def add(a, b):
# print "ADDING %d + %d" % (a, b)
return a + b
def subtract(a, b):
#print "SUBTRACTING %d - %d" % (a, b)
return a - b
def multiply(a, b):
#print "MULTIPLYING %d * %d" % (a, b)
return a * b
def divide(a, b):
# print "DIVIDING %d / %d" % (a, b)
return a / b
if __name__ == '__main__':
divide(10,2)
the result I am getting is
return value is:
there no any value.Please help.Thank you in advance. :)