时间:2021-07-01 10:21:17 帮助过:11人阅读
Other environment variables:
PYTHONPATH : ':'-separated list of directories prefixed to the
default module search path. The result is sys.path.
也就是PYTHONPATH设置了的话,相当于python要运行的文件会在相应目录搜索。
所以对于PHP有没相应的功能?
我用ProcessBuilder,这样它能找到zip文件中的php文件
List commands = new java.util.ArrayList();
commands.add("python");
commands.add("-m");
commands.add("test");//test.py is in test.zip
ProcessBuilder pb = new ProcessBuilder();
pb.command(commands);
Map workerEnv = pb.environment();
workerEnv.put("PYTHONPATH", "/path/to/test.zip");//可见PYTHONPATH设置了,就相当于java里的-cp设置了
Process worker = pb.start();
如果用ProcessBuilder传入这个environment,怎么做?
以致能够在让ProcessBuilder运行zip文件中的PHP文件?
非常感谢!
比如python,在命令行敲python -h会有
Other environment variables:
PYTHONPATH : ':'-separated list of directories prefixed to the
default module search path. The result is sys.path.
也就是PYTHONPATH设置了的话,相当于python要运行的文件会在相应目录搜索。
所以对于PHP有没相应的功能?
我用ProcessBuilder,这样它能找到zip文件中的php文件
List commands = new java.util.ArrayList();
commands.add("python");
commands.add("-m");
commands.add("test");//test.py is in test.zip
ProcessBuilder pb = new ProcessBuilder();
pb.command(commands);
Map workerEnv = pb.environment();
workerEnv.put("PYTHONPATH", "/path/to/test.zip");//可见PYTHONPATH设置了,就相当于java里的-cp设置了
Process worker = pb.start();
如果用ProcessBuilder传入这个environment,怎么做?
以致能够在让ProcessBuilder运行zip文件中的PHP文件?
非常感谢!
通过在php.ini
中的include_path
配置或者使用set_include_path
函数就能设置。