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学习者快速成长!