void File_HtAccess::setAuthUserFile (
string $file
)
authuserfile プロパティの値を設定します。AuthUserFile はユーザー名:パスワードのペアを含む Basic 認証のためのパスワードファイルです。 動作させるためにはパスワードファイルへのフルパスを与える必要があります。
string $file
-
パスワードファイルへの絶対パス名を指定します。
void
This function can not be called statically.
File_HtAccess::setAuthUserFile() の使用
<?php
require_once('File/HtAccess.php');
/* パスワードファイルに /etc/htpasswd を使用する */
$fh = new File_HtAccess('.htaccess');
$fh->load();
$fh->setAuthUserFile('/etc/htpasswd');
$fh->save();
/* パスワードファイルにカレントディレクトリにある .htpasswd を使用する */
$file = getcwd() . '/.htpasswd';
$fh = new File_HtAccess('.htaccess');
$fh->load();
$fh->setAuthUserFile($file);
$fh->save();
?>