douhunkuang8955 2017-08-23 10:12
浏览 192
已采纳

如何在Drupal 8中获取当前用户对象?

I am proficient in Drupal 7 where I get the current user object from global $user, but how do I get it in Drupal 8 ?

  • 写回答

3条回答 默认 最新

  • dongren4099 2017-08-23 10:15
    关注

    Please use following code to get the current user object in Drupal 8: $user = \Drupal::currentUser();

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?