【问题标题】:csrf chack with phalcon php and angularcsrf chack 与 phalcon php 和 angular
【发布时间】:2014-04-30 14:18:07
【问题描述】:

我正在使用 Phalcon PHP 和 Angular JS,并且我有一个带有隐藏输入的表单:

<input type="hidden" name="{{ security.getTokenKey() }}" value="{{ security.getToken() }}" >

我使用ng-submit 提交表单。在控制器中,我做了:

$post   =   $this->request->getJsonRawBody();

foreach($post as $postName => $postValue) {
   $_POST[$postName]   =   $postValue;
}
if($post && $this->security->checkToken())  {

}

但检查令牌返回 false。有人知道吗?

谢谢

【问题讨论】:

  • 你得到了错误但令牌在$_POST?

标签: php angularjs phalcon


【解决方案1】:

您是否向 Dependency Injector 添加了会话适配器?

$di->setShared('session', function() {
    $session = new Phalcon\Session\Adapter\Files();
    $session->start();
    return $session;
});

【讨论】:

    猜你喜欢
    • 2015-11-11
    • 2016-08-28
    • 2015-03-21
    • 2016-10-12
    • 2015-01-13
    • 1970-01-01
    • 2015-07-20
    • 2014-02-01
    • 2015-01-10
    相关资源
    最近更新 更多