Home >Backend Development >PHP Tutorial >About the pitfalls encountered by PHP Shell_exec
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
to the following picture, which is a perfect solution.
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!