forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosinfo.php
More file actions
27 lines (25 loc) · 767 Bytes
/
osinfo.php
File metadata and controls
27 lines (25 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once( 'header.inc.php' );
$osrelease = @file('/etc/os-release', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$info = [];
if ($osrelease) {
foreach ($osrelease as $line) {
if (strpos($line, '=') !== false) {
list($key, $value) = explode('=', $line, 2);
$info[$key] = trim($value, '"');
}
}
if (isset($info['ID']) && isset($info['VERSION_ID'])) {
echo 'OS 정보: <span style="color: red; font-size: 20px;">'
. strtolower($info['ID'])
. $info['VERSION_ID']
. '</span>';
} elseif (isset($info['PRETTY_NAME'])) {
echo $info['PRETTY_NAME'];
} else {
echo "배포판 정보 확인 불가";
}
} else {
echo "/etc/os-release 파일 없음";
}
?>