我正在本地帖子中处理来自serveur的代码,但是我遇到了此错误,我该如何解决?
ContextErrorException in Display.php line 0:
Warning: Declaration of BWDisplay::setTemplate($template) should be compatible with FrontControllerCore::setTemplate($template, $params = Array, $locale = NULL)
答案 0 :(得分:0)
在PHP 7+中,如果要覆盖或扩展方法,则必须声明相同的参数(即使它们在父类方法中具有默认值)和相同的访问级别。在您的代码中,似乎您扩展了document.getElementById('title').firstChild.data = text + " ";
类,因此您需要遵循规则并填充所有参数,或者至少设置与父类FrontController
答案 1 :(得分:0)
尝试替换:
$param = array();
$locale = 'NULL';
BWDisplay::setTemplate($template, $params, $locale);
通过
RouterTestingModule.withRoutes([
{ path: 'post/view', component: BlankComponent },
])
致谢