我一直在看这个教程在Silverstripe(3.0.5)的管理区添加一个简单的页面,但是在apache日志中得到分段错误。
我认为问题是"customHelp.php"中的"index"方法-当我将"index"重命名为其他东西时,我没有在管理菜单中获得崩溃和条目,但显然当我点击它时没有显示任何内容。
这是我的"customHelp.php"的内容-有人能指出我在正确的方向吗?
<?php
class customHelp extends LeftAndMain {
static $url_segment = "customHelp";
static $menu_title = "Site Help";
static $allowed_actions = array ('customHelp');
public function index() {
return $this->renderWith('customHelp');
}
public function init() {
parent::init();
}
}
我猜这个教程不正确或过时了。
我在这里试了一下,得到了错误:
Declaration of customHelp::index() should be compatible with that of LeftAndMain::index()
使它兼容于覆盖:
public function index($request) {
return $this->renderWith('customHelp');
}
可能不相关,但您应该在类名中使用正确的命名约定,即使指南建议这样做:
类应该以大写字母http://doc.silverstripe.org/framework/en/trunk/misc/coding-conventions开头,文件名应该紧随其后。
当你在一个区分大小写的服务器上运行文件时,你可能会遇到问题。
编辑:突然想到索引问题可能是由未刷模板缓存引起的:run ?flush=all on the site.