「smartyでマ行で落ちる時の対応法(shift_jis対応)」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
*●参考サイト
http://www.ninnin.net/blog/archives/000356.html
*●共通系のところに下記関数追加
//--------------------------------
// Smarty SJIS対応用関数1
//--------------------------------
function convert_encoding_to_eucjp($template_source) {
if (function_exists("mb_convert_encoding")) {
//文字コードを変換する
return mb_convert_encoding($template_source, "EUC-JP", "SJIS");
}
return $template_source;
}
//--------------------------------
// Smarty SJIS対応用関数2
//--------------------------------
function convert_encoding_to_sjis($template_source) {
if (function_exists("mb_convert_encoding")) {
//文字コードを変換する
return mb_convert_encoding($template_source, "SJIS", "EUC-JP");
}
return $template_source;
}
*●smartyオブジェクトをnewしたあとに以下を追加
$smarty->register_prefilter("convert_encoding_to_eucjp");
$smarty->register_postfilter("convert_encoding_to_sjis");