How do I properly split a PATH variable in PHP?(如何在 PHP 中正确拆分 PATH 变量?)
问题描述
我要分手
$path = getenv('PATH');
到它的组件中.如何以依赖于操作系统的方式确定分隔符?
into its components. How do I determine the separator char in an os-dependent fashion?
推荐答案
您可以使用 PATH_SEPARATOR
常量,然后根据需要使用 DIRECTORY_SEPARATOR
常量来分割路径.请参阅 目录预定义常量
You can use the PATH_SEPARATOR
constant, then the DIRECTORY_SEPARATOR
constant to split the path if needed.
See Directory Predefined Constants
这篇关于如何在 PHP 中正确拆分 PATH 变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!