1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linuxdash_ynh.git synced 2024-09-03 19:36:07 +02:00
linuxdash_ynh/sources/sh/df.php
2014-06-02 13:38:03 +02:00

19 lines
393 B
PHP

<?php
exec('/bin/df -h|awk \'{print $1","$2","$3","$4","$5","$6}\'', $result);
header('Content-Type: application/json; charset=UTF-8');
echo "[";
$x = 0;
$max = count($result)-1;
foreach ($result as $a) {
if ($x==0) {
$x++;
continue;
}
echo json_encode(explode(',', $result[$x]));
echo ($x==$max) ? '' : ',';
unset($result[$x], $a);
$x++;
}
echo ']';