0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ファイルEUC-JPをUTF-8
sedコマンドとは
sedとはStream EDitorの略で、入力されたテキストデータを1行ずつ読み込んで指定した処理を適用して出力を行います。主に文字列の置換や抽出に用いられます。

<?php
$dir = "./templates";
 
// 既知のディレクトリをオープンし、その内容を読み込みます。
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
	  if(strpos($file, 'tpl')){
	  //if($file=='addlist.php'){
            echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
		exec ('sed -i -e \'s/EUC-JP/UTF-8/g\' ./templates/'.$file);
	  }
        }
        closedir($dh);
    }
}
?>

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?