File_HtAccess::setRequire()

File_HtAccess::setRequire() – set the value of require property

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();

?>
saves the .htaccess file (Previous) add a value into 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.