ソースコード内のすべての漢字を検索できるツール

WBOY
リリース: 2016-06-13 12:36:54
オリジナル
780 人が閲覧しました

ソースコード内のすべての漢字を検索できるツール

$sf を検索したいパスを入力するだけです。

機能
1 すべての漢字を検索
2 コメント文内の漢字を無視
3 無視する必要があるファイルとフォルダーを追加
4 ログ ファイルを生成

ソフトウェアの言語パックの更新が心配な場合は
このツールをご利用ください。

私の例:
http://127.0.0.1/tools/searchcn.php
http://127.0.0.1/tools/cnlog.txt

コードをコピー コードは次のとおりです:


set_time_limit(0);
ob_implicit_flush();

//コメント形式
$remark = array(
array('/ /debug', "rn")
、array('/**「、」*/')
、array('/*debug<🎝>*/')
、array('/ *note<🎝>*/')
, array('//note', "rn")
);

//以下のディレクトリとファイルはクエリされません
$ filter = 'forumdata|config.inc.php|debug|test|readme|utilities|upgrade|.tpl.php|index.htm|.lang.php';

//プロジェクト ディレクトリ
$ sf = 'd:\data\labs\develop\dzhead\';

//ログディレクトリ
$logname = 'cnlog.txt';
$langfile = 'lang.php';


$log = fopen($logname, 'w');
fclose($log);

$lf = fopen($langfile, 'wb');
fwrite($lf, "rnrnt'spilt' => '-------------------------------- - ------------------',");
fclose($lf);

$lf = fopen($langfile, 'ab' ) ;


$ptag = '\';

findfile($sf);
fwrite($lf, "rn);rnrn?>"); 🎜 >fclose($lf);
function findfile($sf){
グローバル $ptag, $logname, $filter, $lf;
$log = fopen($logname, 'ab');
グローバル $remark;
if(is_dir($sf)) {
if($dh = opendir($sf)) {

while(($file = readdir($dh) ) ) !== false) {
sf.$file) == 'dir') {
$/', $file)) && !preg_match('/('.$filter.')/' , $sf.$file)) {

'rb'); p, ファイルサイズ($sf.$file));
fclose($sfp);
foreach( $remark as $v) {
$data = '';
while(count($strcut =explode($v[0], $buf, 2)) > 1) {
$data .= $strcut[0];
If ($ Strcut = Explode ($ v [1], $ Strcut [1], 2) & gt; 1) {
$ buf = $ strcut [1]; else {
$buf = $strcut[0];
休憩;
}

}
$data .= $strcut[0];
$buf = $data;
}
$data = $buf;
$lines = 0;
$cn = $str = '';
$cns = 0;
$ldata = "rnt'".str_replace('.', '_', $file)."' => '";
for($i = 0; $i < strlen($data); $i ){
$c = ord($data{$i});
if($c == 0x0A || $data{$i 1} == ''){
$lines ;
if(!empty($cn)){
$ldata .= "',";
$ldata = str_replace("rnt'".str_replace('.', '_', $file)."' => ",", ", $ldata);
fwrite($lf, $ldata);
$cn = "rn$lines:".$cn;
$str .= $cn;
$cn = '';
$ldata = "rnt'".str_replace('.', '_', $file)."' => '";
}
elseif($c >= 0x81 && $c $c = ord($data{ $i});
if($c >= 0x40 && $c <= 0xFE) {
$cn .= $data{$i-1}.$data {$i};
$ldata .= $data{$i-1}.$data{$i};
while(($c = ord($data{ $i})) != 0x3C && $c != 0x0A && $c != 0x0D && $c != 0x27 && $c != 0x3E & & $c ! = 0x3B && $c != 0x22 && $c != 0x3D && $c < 0x81) {
$space .= chr($c);
}
$i--;
if(ord($data{$i 1}) < 0x81) {
$cns ;
$cn .= '$';
$ldata .= "',rnt'".str_replace('.', '_', $file)."' => '";
} else {
$cn .= $space;
}
$space = '';
}
}
}
if($str != '') {
fwrite($log, "n--".$sf.$file."---------------- ------- (共 $cns 处)");
echo "{$sf}$file (共 $cns 处)
";
ob_flush();flush();
$cns = 0;    
}
fwrite($log, $str);
$str = '';
}
}
}
}
fclose($log);

}
?>

ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のおすすめ
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!