经测试代码如下:
/**
* 获得Linux 的硬盘UUID
*
* @param
* @author 编程之家 jb51.cc jb51.cc
**/
$dh = opendir('/dev/disk/by-uuid/');
while($file = readdir($dh)){
if(is_link('/dev/disk/by-uuid/'.$file)){
if(realpath('/dev/disk/by-uuid/'.$file) == '/dev/sda1'){
echo 'Found uuid='.$file.PHP_EOL;
}
}
}
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/529099.html