centos 下keepalived-配置文件详解
2015-12-01 09:55
716 查看
把下面代码复制到程序的目录中的文件中,然后运行它!
<?php
set_time_limit(0);
function checkdir($basedir){
if ($dh = opendir($basedir)){
while (($file = readdir($dh)) !== false){
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";
}else{
$dirname = $basedir."/".$file;
checkdir($dirname);
}
}
}
closedir($dh);
}
}
function checkBOM ($filename){
global $auto;
$contents = file_get_contents($filename);
$charset[1] = substr($contents, 0, 1);
$charset[2] = substr($contents, 1, 1);
$charset[3] = substr($contents, 2, 1);
if(ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191){
if($auto == 1){
$rest = substr($contents, 3);
rewrite ($filename, $rest);
return ("<font color=red>BOM found, automatically removed.</font>");
}else{
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite($filename, $data){
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
if (isset($_GET['dir'])){
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
?>
本文出自 “背吉他的攻城师” 博客,谢绝转载!
<?php
set_time_limit(0);
function checkdir($basedir){
if ($dh = opendir($basedir)){
while (($file = readdir($dh)) !== false){
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";
}else{
$dirname = $basedir."/".$file;
checkdir($dirname);
}
}
}
closedir($dh);
}
}
function checkBOM ($filename){
global $auto;
$contents = file_get_contents($filename);
$charset[1] = substr($contents, 0, 1);
$charset[2] = substr($contents, 1, 1);
$charset[3] = substr($contents, 2, 1);
if(ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191){
if($auto == 1){
$rest = substr($contents, 3);
rewrite ($filename, $rest);
return ("<font color=red>BOM found, automatically removed.</font>");
}else{
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite($filename, $data){
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
if (isset($_GET['dir'])){
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
?>
本文出自 “背吉他的攻城师” 博客,谢绝转载!
相关文章推荐
- Linux下svn命令详解
- LNMP系列(3)centos 6.0 下PHP安装
- 工作中用到的一些Linux命令
- Linux下Sublime Text 2的安装
- linux free命令中buffer与cache的区别
- CentOS快捷键总结
- linux下无法添加用户和组
- linux下微妙级别定时实现
- centos 老出现You have new mail in /var/spool/mail/root 解决
- centos 老出现You have new mail in /var/spool/mail/root 解决
- Linux系统下安装ngnix
- 如何在 Linux 终端下创建新的文件系统/分区
- linux 远程桌面连接
- centos7 登陆报错 grep:write error
- Linux下搭建个人网站
- linux下安装java
- VMware Workstation 10+Centos7(64位)共享文件夹问题
- linux sort 命令详解
- linux 下安装opencv3.0在编译时出现的问题undefined reference to `parallel_pthreads_set_threads_num(int)'
- Linux Mint 升级gpg