PEAR Manual
Prev |  | Next

# File_HtAccess::getRequire()

File_HtAccess::getRequire() -- get the value(s) of require property

## Synopsis

``array File_HtAccess::getRequire` ()`

## Description

Get the value(s) of require property as an array. Require property contains the usernames or groups users who are allowed to access protected resources. Value valid-user means all users listed in password file are allowed to access.

## Parameter

- `string $type` - if 'string' return value will be a string with usernames separated by a space character. Otherwise return value will be an array(). Defaults to an array.

## Return value

mixed string or array depending on $type parameter.

## Note

This function can not be called statically.

## See

File_HtAccess::setRequire()
File_HtAccess::delRequire()
File_HtAccess::getRequire()

## Example

Example 38-1. Using File_HtAccess::getrequire()
    <?php
    require_once('File/HtAccess.php');

    /* add user tuupola and viemero to list of users to be granted access */
    $fh = new File_HtAccess('.htaccess');
    $fh->addRequire('tuupola');
    $fh->addRequire('viemero');

    $require1 = $fh->getRequire();
    $require2 = $fh->getRequire('string');

    print_r($require1);

    /* Array              */
    /* (                  */
    /*    [0] => tuupola  */
    /*    [1] => viemero  */
    /* )                  */

    print_r($require2);

    /* tuupola viemero    */

    ?>

Prev | Home | Next
File_HtAccess::delRequire() | Up | File_HtAccess::setProperties()