How to obtain system partition information with php under Linux system_PHP tutorial

WBOY
Release: 2016-07-13 09:59:01
Original
813 people have browsed it

How to obtain system partition information with PHP under Linux system

This article mainly introduces the method for obtaining system partition information with PHP under Linux system, and involves the operation of PHP system analysis under Linux The skills have certain reference value. Friends who need them can refer to them

The example in this article describes the method of obtaining system partition information in PHP under Linux system. Share it with everyone for your reference. The specific implementation method is as follows:

?

1

2

3

4

5

6

7

8

9

10

$pars = array_filter(explode("n",`df -h`));

foreach ($pars as $par) {

if ($par{0} == '/') {

$_tmp = array_values(array_filter(explode(' ',$par)));

reset($_tmp);

echo "分区挂载点:{$_tmp['5']}," .

"总大小:{$_tmp['1']}" .

"已使用:{$_tmp['2']}({$_tmp['4']})
";

}

}

1 2

3

4 5

67 8 9 10
$pars = array_filter(explode("n",`df -h`)); foreach ($pars as $par) { if ($par{0} == '/') {
$_tmp = array_values(array_filter(explode(' ',$par))); reset($_tmp); echo "Partition mount point: {$_tmp['5']}," . "Total size: {$_tmp['1']}" . "Used: {$_tmp['2']}({$_tmp['4']})
"; } }
I hope this article will be helpful to everyone’s PHP programming design. http://www.bkjia.com/PHPjc/976545.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/976545.htmlTechArticleHow to obtain system partition information through php under Linux system. This article mainly introduces how to obtain system partition information through php under Linux system. The method involves the operation skills of php system analysis under Linux, with a...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template