douchao1957 2017-06-12 19:34
浏览 35
已采纳

SilverStripe - 模板可变投掷错误

I have a really basic function that I started. I began very simple with in code/Page.php:

public function createGreeting() {
    return 'hi';
}

In my Page.ss template, I have the variable: <% $createGreeting %>

Yet, this is killing the page. I checked the error logs, and it is showing:

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

Any idea what could be causing this? If I remove that line from Page.ss, the page loads perfectly fine.

  • 写回答

1条回答 默认 最新

  • dongtang1909 2017-06-12 22:17
    关注

    You shouldn't wrap the variable in a <% %> block, but rather, just call it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)