PEAR Manual
This manual is provided as a courtesy. It is not an official source. Please check pear.php.net for updated information.
mixed File_HtAccesss:save ()
mixed File_HtAccesss:save
Saves the contents of File_HtAccess object as a corresponding .htaccess file on the disc.
mixed - Returns TRUE on success, PEAR_Error on failure.
This function can not be called statically.
Example 38-1. Using File_HtAccess::save()
<?php require_once('File/HtAccess.php'); /* create a new .htaccess file with given parameters */ $params['authname'] = 'Private'; $params['authtype'] = 'Basic'; $params['authuserfile'] = '/path/to/.htpasswd'; $params['authgroupfile'] = '/path/to/.htgroup'; $params['require'] = array('group', 'admins'); $fh = new File_HtAccess('.htaccess', $params); $status = $fh->save(); if (PEAR::isError($status)) { // handle errors } else { // continue processing } ?>