Я работаю над алгоритмом классификации в python и он связан с php-кодом, чтобы получить правильный результат, я должен запустить свой python exe, а затем перейти к php-коду.
Я хочу выполнить Python самостоятельно с кодом PHP. Я попробовал это:
<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>
Но это не работает, я должен знать больше о пути? а как поставить свой exe в путь записи?
<?php
exec("C:\\Users\\posh\\AppData\\Local\\Programs\\Python\\Python35\\python.exe YOUR_PYTHONSCRIPT.py <arguments if any>", $output, $ret_code);
// directly writing python may not work in that case
// give path to python.exe
exec("python YOUR_PYTHONSCRIPT.py <arguments if any>", $output, $ret_code);
// $ret_code : returns the code 0 or 1
// output is an array
?>
Других решений пока нет …