rm — -foo
在 — 後面的 特殊符號就不做解譯
rm — -foo
在 — 後面的 特殊符號就不做解譯
避免 $user_list 是空的 array 時 出現 Warnning
[code language=’php’]
$months = array(
‘Jul’ => ’07’,
‘Aug’ => ’08’,
‘Sep’ => ’09’
);
$open_file = false;
$fw = false;
$fp = fopen(‘filename.log’, ‘r’);
while($line = fgets($fp)) {
preg_match(‘:([0-9]{2})/(Jul|Aug|Sep):’, $line, $matches);
// $matches[1] = day of month
// $matches[2] = month name
$filename = “filename.log.2007{$months[$matches[2]]}{$matches[1]}”;
if($filename != $open_file) {
if($fw) {
fclose($fw);
}
$fw = fopen($filename, ‘a’);
$open_file = $filename;
echo “$filename\n”;
}
fputs($fw, $line);
}
fclose($fw);
fclose($fp);
[/code]
<VirtualHost *:80>
ServerName toy.monster.tw
ServerAdmin [email protected]
DocumentRoot “/var/www/toy.monster.tw”
CustomLog /var/www/toy.monster.tw/log/access_log.txt combined
<Directory “/var/www/toy.monster.tw”>
Options FollowSymLinks
AllowOverride All
# AllowOverride controls what directives may be placed in .htaccess files.
Order allow,deny
Allow from all
</Directory>
</VirtualHost>