Introduction

Introduction – Introduction to File_Fstab.

Overview

This package allows you to read, manipulate, and write fstab-format files, such as /etc/fstab, /etc/mtab, and /proc/mounts.

Examples

Getting the filesystem type of the root device.

<?php
require_once 'File/Fstab.php';

$fstab =& new File_Fstab();

$root =& $fstab->getEntryForPath('/');
echo 
"Root FS type: " $root->fsType "\n";
?>

Determine if a user may mount the CD-ROM

The user option in your fstab determines whether users may mount a given device or not.

<?php
require_once 'File/Fstab.php';

$fstab =& new File_Fstab();

$cd =& $fstab->getEntryForDevice('/dev/cdrom');
if (
$cd->hasOption('user')) {
    echo 
"Users may mount the CD-ROM\n";
} else {
    echo 
"Users may not mount the CD-ROM\n";
}
?>
File_Fstab (Previous) Entries (Next)
Last updated: Tue, 02 Jun 2009 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.