File_HtAccess::setRequire()
Synopsis
void File_HtAccess::setRequire (
mixed $require
)
Description
Sets the value of require property.This overwrites the previous value. If you need to add a value (user) to require use File_HtAccess::addRequire() instead. Using this method you can control which users will be able to access the protected resources.
Parameter
-
mixed $require
- value the requre property to be set to. Can be given as a string or an array. If given as a string separate multiple values with a space.
Return value
void
Note
This function can not be called statically.
Example
Using File_HtAccess::setRequire()
<?php
require_once('File/HtAccess.php');
/* let any valid user access the resource */
$fh = new File_HtAccess('.htaccess');
$fh->load();
$fh->setRequire('valid-user');
$fh->save();
/* let user tuupola or panula access the resource */
$fh = new File_HtAccess('.htaccess');
$fh->load();
$fh->setRequire(array('user', 'tuupola', 'panula'););
$fh->save();
/* let anyone from group admins to access the resource */
$fh = new File_HtAccess('.htaccess');
$fh->load();
$fh->setRequire(array('group', 'admins'););
$fh->save();
?>