function getOS(){
if(PATH_SEPARATOR==':'){
echo "Linux";
}else{
echo "Windows";
}
}
getOS();
根据PATH_SEPARATOR判断,在Linux中,PATH_SEPARATOR为 ':',在Windows系统下,PATH_SEPARATOR为';'。
function getOS(){
if(PATH_SEPARATOR==':'){
echo "Linux";
}else{
echo "Windows";
}
}
getOS();
根据PATH_SEPARATOR判断,在Linux中,PATH_SEPARATOR为 ':',在Windows系统下,PATH_SEPARATOR为';'。