当前位置: 首页>>代码示例>>PHP>>正文


PHP checkBOM函数代码示例

本文整理汇总了PHP中checkBOM函数的典型用法代码示例。如果您正苦于以下问题:PHP checkBOM函数的具体用法?PHP checkBOM怎么用?PHP checkBOM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了checkBOM函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trimbom_recursion

function trimbom_recursion($path)
{
    $flag = FilesystemIterator::SKIP_DOTS | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO;
    $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, $flag), RecursiveIteratorIterator::CHILD_FIRST);
    foreach ($objects as $value) {
        $realpath = $value->getRealpath();
        $value->isFile() ? var_dump(checkBOM($value)) : true;
    }
}
开发者ID:wadee,项目名称:other,代码行数:9,代码来源:trimbom.php

示例2: saveFile

 public function saveFile($path, $conent)
 {
     $path = $this->baseDir() . $path;
     $path = $this->trimPath($path);
     $isBOM = checkBOM($path);
     if ($isBOM) {
         writeUTF8WithBOMFile($path, $conent);
         return true;
     } else {
         return file_put_contents($path, $conent);
     }
     return false;
 }
开发者ID:norain2050,项目名称:yershop,代码行数:13,代码来源:admin.php

示例3: checkdir

function checkdir($basedir)
{
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($basedir . "/" . $file)) {
                    echo "filename: {$basedir}/\r\n\r\n{$file} " . checkBOM("{$basedir}/{$file}") . " <br>";
                } else {
                    $dirname = $basedir . "/" . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:16,代码来源:zmr.php

示例4: checkdir

function checkdir($basedir)
{
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($basedir . '/' . $file)) {
                    $filename = $basedir . '/' . $file;
                    echo 'filename:' . $basedir . '/' . $file . checkBOM($filename) . '<br>';
                } else {
                    $dirname = $basedir . '/' . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:976112643,项目名称:manor,代码行数:17,代码来源:clearBOM.php

示例5: checkdir

function checkdir($basedir)
{
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..' && $file != '.svn') {
                if (!is_dir($basedir . "/" . $file)) {
                    if (checkBOM("{$basedir}/{$file}") == 1) {
                        echo "filename: {$basedir}/{$file} <font color=red>tồn tại, đã tự động xóa.</font> <br>";
                    }
                } else {
                    $dirname = $basedir . "/" . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:18,代码来源:cleanbom.php

示例6: checkdir

function checkdir($basedir)
{
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($basedir . "/" . $file)) {
                    if (checkBOM("{$basedir}/{$file}") == 1) {
                        echo "filename: {$basedir}/{$file}<font color=red>found bom and remove!</font><br>";
                    }
                } else {
                    $dirname = $basedir . "/" . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:babyhuangshiming,项目名称:webserver,代码行数:18,代码来源:del_bom.php

示例7: checkdir

function checkdir($basedir)
{
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..' && $file != '.svn') {
                if (!is_dir($basedir . "/" . $file)) {
                    $res = checkBOM("{$basedir}/{$file}");
                    if ($res != 'BOM Not Found.') {
                        echo "filename: {$basedir}/{$file} " . $res . " <br>";
                    }
                } else {
                    $dirname = $basedir . "/" . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:19,代码来源:bom.php

示例8: checkdir

function checkdir($basedir = '', $loop = true)
{
    $basedir = empty($basedir) ? '.' : $basedir;
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($basedir . '/' . $file)) {
                    echo '文件: ' . $basedir . '/' . $file . checkBOM($basedir . '/' . $file) . ' <br>';
                } else {
                    if (!$loop) {
                        continue;
                    }
                    $dirname = $basedir . '/' . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
}
开发者ID:zhxiho,项目名称:Work,代码行数:20,代码来源:newfile.php

示例9: bakindata

/**
 * 执行备份文件的SQL语句
 *
 * @param string $filename
 */
function bakindata($filename)
{
    $DB = Database::getInstance();
    $setchar = $DB->getMysqlVersion() > '4.1' ? "ALTER DATABASE `" . DB_NAME . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" : '';
    $sql = file($filename);
    if (isset($sql[0]) && !empty($sql[0]) && checkBOM($sql[0])) {
        $sql[0] = substr($sql[0], 3);
    }
    array_unshift($sql, $setchar);
    $query = '';
    foreach ($sql as $value) {
        $value = trim($value);
        if (!$value || $value[0] == '#') {
            continue;
        }
        if (preg_match("/\\;\$/i", $value)) {
            $query .= $value;
            if (preg_match("/^CREATE/i", $query)) {
                $query = preg_replace("/\\DEFAULT CHARSET=([a-z0-9]+)/is", '', $query);
            }
            $DB->query($query);
            $query = '';
        } else {
            $query .= $value;
        }
    }
}
开发者ID:flyysr,项目名称:emlog,代码行数:32,代码来源:data.php

示例10: while

//修改此行为需要检测的目录,点表示当前目录
if (isset($_GET['dir'])) {
    $basedir = $_GET['dir'];
} else {
    $basedir = ".";
}
//是否自动移除发现的BOM信息。1为是,0为否。
if (isset($_GET['auto'])) {
    $auto = 0;
} else {
    $auto = 1;
}
if ($dh = opendir($basedir)) {
    while (($file = readdir($dh)) !== false) {
        if ($file != '.' && $file != '..' && !is_dir($basedir . "/" . $file)) {
            echo "filename: {$file} " . checkBOM("{$basedir}/{$file}") . " <br>";
        }
        if ($file != '.' && $file != '..' && is_dir($basedir . "/" . $file)) {
            echo "<a href='?dir=" . $basedir . "/" . $file . "'>" . $basedir . "/" . $file . "</a><br>";
        }
    }
    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) {
开发者ID:king3388,项目名称:king,代码行数:31,代码来源:bom.plugin.php

示例11: checkdir

function checkdir($basedir)
{
    static $num = 0;
    if ($dh = opendir($basedir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($basedir . "/" . $file)) {
                    if (file_ext($file) == 'php' && checkBOM("{$basedir}/{$file}", false)) {
                        echo "filename: {$basedir}/{$file} <b style='color:red'>bom found.</b><br/>";
                        $num++;
                    }
                } else {
                    $dirname = $basedir . "/" . $file;
                    checkdir($dirname);
                }
            }
        }
        closedir($dh);
    }
    return $num;
}
开发者ID:project-store,项目名称:phpsite,代码行数:21,代码来源:t.php


注:本文中的checkBOM函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。