Skip to content

Instantly share code, notes, and snippets.

@dataich
Last active March 8, 2019 23:46
Show Gist options
  • Save dataich/de5ccba89cd76d07963d2bc3c2de05dd to your computer and use it in GitHub Desktop.
Save dataich/de5ccba89cd76d07963d2bc3c2de05dd to your computer and use it in GitHub Desktop.
<?php
//
// 画面出力時に、テンプレートをUTF-8からSJISに変換する。
//
function filterUTF8ToSJIS($buff, &$smarty) {
return mb_convert_encoding($buff,"SJIS","UTF-8");
}
$smarty= new Smarty(); //Smartyオブジェクト生成
$smarty->register_outputfilter("filterUTF8ToSJIS"); //フィルターの登録
ini_set("default_charset", "Shift_JIS"); //PHPの設定default_charsetにSJISを設定
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment