File_HtAccess::save()

File_HtAccess::save() – saves the .htaccess file

Synopsis

mixed File_HtAccesss:save ( )

Description

Saves the contents of File_HtAccess object as a corresponding .htaccess file on the disc.

Return value

mixed - Returns TRUE on success, PEAR_Error on failure.

Note

This function can not be called statically.

Example

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
}

?>
load the contents of existing .htaccess file (Previous) set the value of require property (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.