在Silverstripe 4中遇到错误

时间:2018-03-06 10:57:08

标签: silverstripe

我正在使用Silverstripe 4并创建了一个带有表单的页面。出了点问题,我只得到一个空白页面:

“似乎存在技术问题。请点击后退按钮,刷新浏览器,然后重试。”

  • 在.htaccess中,我在
  • 上设置了php_flag display_errors
  • 在_config.php中我设置了error_reporting(E_ALL);
  • 在mysite / _config / app.yml中我设置了这个:

,只有:   环境:'dev'

SilverStripe \安全\基本验证:   whole_site_protected:true

现在我想做的就是让Silverstripe向我展示错误。在Silverstripe 3中,唯一要做的是:Director :: set_environment_type(“live”);

我该怎么做才能显示错误?

2 个答案:

答案 0 :(得分:2)

.env文件中,您可以指定环境变量。

SS_ENVIRONMENT_TYPE='dev'

答案 1 :(得分:1)

术语"似乎存在技术问题"是CSRF失败的通知:https://github.com/silverstripe/silverstripe-framework/blob/7603c6d79841df7712c0d1d5136ec402f3162e0c/lang/en.yml#L60

所以将silverstripe设置为dev模式或调整php错误级别在这里没有帮助,因为它只是在csrf检查失败时输出。

您需要添加令牌或阻止表单处理程序检查它:

https://docs.silverstripe.org/en/4/developer_guides/forms/form_security/#cross-site-request-forgery-csrf

如果表单的所有内容都正确,那么错误可能是由PHP和会话写入目录的权限问题引起的。