さくらのレンタルサーバーを用いて、
PHPとSmartyの勉強をしています。
GET送信をsmartyのテンプレートで表示した場合、
なぜか、
文字化けしてしまいます。
【php.ini】default_charset = "UTF-8"mbstring.language = "Japanese"mbstring.internal_encoding = "UTF-8"mbstring.encoding_translation = Offmbstring.http_output = "UTF-8"allow_url_fopen = Onallow_url_include = Onfile_uploads = Oninclude_path=".:/home/hirotopia/pear/PEAR;.:/home/hirotopia/pear/SMARTY/libs"【phpファイル】<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><?
phprequire_once("Smarty/libs/Smarty.class.php");$smarty = new Smarty();$smarty->template_dir = "template/";$smarty->compile_dir = "compile/";$datas = array("name"=>"tarou","age"=>"18","job"=>"学生");$smarty->assign("datas", $datas);$get=mb_detect_encoding($_GET["name"]);$smarty->assign("get", $get);$smarty->display("user.tpl");?
>【テンプレートファイル】{foreach from=$datas name="test" key="key" item="value"}キー値:{$key}、
値:{$value}<br />{* これはコメントです *}{foreachelse}デーがありません。
{/foreach}<br />入力されたパラメータは {$smarty.get.test|escape}です。
文字のエンコードを調べた結果GET送信は、
{$get}みたいです。
{debug output="javascript"}【上記の実行結果】http://hirotopia.sakura.ne.jp/smarty01.php?
test=%83e%83X%83gPHPの先生に質問したり、
様々な設定を試みたのですが、
解決できませんでした。
ご教授お願い致します。
日時:2010/04/06 14:16 Yahoo!知恵袋