Home >Backend Development >PHP Tutorial >About the pitfalls encountered by PHP Shell_exec

About the pitfalls encountered by PHP Shell_exec

藏色散人
藏色散人forward
2020-01-02 17:23:492918browse

Because you need to use shell_exec to execute python scripts in the project, under test shell_exec("test.py") can run normally without errors, but adding a directory shell_exec("python/test.py") will not work. Use For the PHP framework, I initially thought that the reason was PHP's directory limitation, but after trying to no avail, I found that it was not a directory problem.

So I thought maybe the shell_exec command does not support directories? A word awakened the dreamer, shell_exec is equivalent to command line execution

The code can be changed from the original

About the pitfalls encountered by PHP Shell_exec

to the following picture, which is a perfect solution.

About the pitfalls encountered by PHP Shell_exec

For more PHP related knowledge, please visit PHP Tutorial!

The above is the detailed content of About the pitfalls encountered by PHP Shell_exec. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete