我有一个非常基本的功能,我开始。我在code/Page.php
中开始非常简单:
public function createGreeting() {
return 'hi';
}
在我的Page.ss
模板中,我有变量:<% $createGreeting %>
然而,这是在扼杀页面。我检查了错误日志,它显示:
PHP message: PHP Warning: Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /usr/share/nginx/html/lungmap/framework/control/Director.php on line 488" while reading upstream, client: 31.210.102.114, server: 52.90.93.59, request: "GET / HTTP/1.0", upstream: "fastcgi://unix:/var/run/php/php5.6-fpm.sock:" 2017/06/12 12:34:50 [error] 1730#0: *6682 FastCGI sent in stderr: "PHP message: PHP Warning: Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /usr/share/nginx/html/lungmap/framework/control/Director.php on line 488
知道可能导致这种情况的原因是什么?如果我从Page.ss
删除该行,则页面加载完全正常。
答案 0 :(得分:6)
你不应该将变量包装在<% %>
块中,而只是调用它。