smarty模板输出字符乱码解决方法

WBOY
發布: 2016-06-13 11:59:03
原創
1160 人瀏覽過

smarty模板输出字符乱码
我创建了config.conf作为配置文件,想运用smarty模板导入并在页面输出
PHP,html和config.conf为编码方式都为utf8,firefox浏览器unicode
页面却出乱码

我将config.conf改成ANSI编码方式

我推断可能与smarty本身的编码方式有关
我从其他人那里拷贝了一个smarty包(我自己的是从官网上下载最新版本的),页面显示正常没有乱码。

config.conf输入信息如下

<br />webTitle=当当网,全球最大的中文网上书店<br />copyRight=当当网<br />icpNum = 123456<br />
登入後複製


html代码
<br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br /><{config_load file="config.conf"}><br /><title><{#webTitle#}></title><br /></head><br /><br /><body><br /><br />---------配置文件demo----------<br /><br /><table align="center" width="400" cellpadding="0" cellspacing="0" border="1"><br />	<tr><br />		<td>copyright</td><br />		<td><{#copyRight#}></td><br />		<td><{#icpNum#}></td><br />	</tr><br /></table><br /></body><br /></html><br />
登入後複製


PHP代码
<br /><?php <br />require_once("smarty/Smarty.class.php");<br />$smarty=new Smarty();<br />$smarty->left_delimiter="<{";<br />$smarty->right_delimiter="}>";<br />$smarty->display("index.html");<br /><br />?><br />
登入後複製


我想问如果还是用原来的smarty包,如何解决以上问题,谢谢各位
------解决方案--------------------
把 config.conf 改成无bom的utf-8编码试试。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!