Home > Article > Backend Development > Get the php path under window or linux
这篇文章介绍的内容是关于 获取window或linux下php路径 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
if(substr(strtolower(PHP_OS), 0, 3) == 'win') { $ini= ini_get_all(); $path = $ini['extension_dir']['local_value']; $b= substr($path,0,-3); $php_path = str_replace('\\','/',$b); $real_path = $php_path.'php.exe'; if(strpos($real_path, 'ephp.exe') !== FALSE) { $real_path = str_replace('ephp.exe', 'php.exe',$real_path); } }else{ $real_path = PHP_BINDIR.'/php'; } echo $real_path;
The above is the detailed content of Get the php path under window or linux. For more information, please follow other related articles on the PHP Chinese website!