Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Excerpt

I usually use shell_exec when I need to run python code. The benefit of shell_exec is returning the result as string, so I can use it for other purpose.



The below is the example to create graph by python, and display as a result in php.

...

Code Block
languagephp
titlematplot_test.php
<?php

$locale = 'ko_KR.UTF-8';
setlocale(LC_ALL, $locale);
putenv('LC_ALL='.$locale);

echo shell_exec("python matplot_test.py");

?>

...

You will be able to see a graph when you run your code like http://your url/..../matplot_test.php

...