Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP

后端 未结 9 709
时光取名叫无心
时光取名叫无心 2020-12-17 03:36

Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP : How can it be done? I want to store it in a file.

OS : windows 2000,XP,ME,Vista.

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 04:00

    On *nix based machine you can also use ls /dev/disk/by-id/ because hdparm need root permission (see Patrick Daryll G. answer).

    &1', $output);
    echo 'HDD: '.$output[0].'
    '; $outputs = explode('_', $outputs[0]); $outputs = end($outputs); echo 'HDD-SN: '.$output.'
    ';

    and you will get something like this

    HDD: ata-HGST_XXX1234567890XX_ABCD123456789X  // -_
    HDD-SN: ABCD123456789X  // Your HDD Serial Number
    

提交回复
热议问题