【发布时间】:2012-01-13 19:24:02
【问题描述】:
我目前正在使用带有 Smarty 模板引擎的 PHP Recess 框架。在我的控制器中,我的代码类似于:
/**
* !View Smarty
* !RespondsWith Smarty
* !Prefix Views: templates/, Routes: /
*/
class XHomeController extends Controller {
/** !Route GET */
function index()
{
$this->title = "Some title...";
}
}
并且,在相应的 Smarty 视图中,我照常引用 {$title}。
除了 Android 浏览器(在我的 2.3 Nexus One、3.2 平板电脑以及 Android 模拟器上)之外,该视图在所有浏览器中都能正确呈现。我认为我已经将问题追溯到 Smarty 视图被渲染并发送到没有 Content-type 的浏览器这一事实。
使用http://web-sniffer.net/,我注意到响应中的 Content-type 为空。
使用 Smarty 时如何在 Recess 中指定 Content-type?我尝试将 header('Content-type: text/html') 添加到控制器中的方法,但这不起作用。
知道我做错了什么吗?
【问题讨论】:
标签: php http http-headers smarty recess