2014-12-13 89 views
0

我用Symfony2創建了一個簡單的登錄系統。我已按照給出的指令 -Symfony2中的「Undefined class Security」

http://symfony.com/doc/current/book/security.html#using-a-traditional-login-form

我已經創造了一切的教程告訴。

這是我的錯誤,我越來越 -

Attempted to load class "Security" from namespace "Symfony\Component\Security\Core" in C:/XAMPP/xamppfiles/htdocs/symfony/src/Custom/TestBundle/Controller/SecurityController.php line 15. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Sensio\Bundle\FrameworkExtraBundle\Configuration\Security. 

我使用PHPStorm。即使我的IDE是顯示像,

enter image description here

我security.yml是看起來像 -

security: 
    encoders: 
     Symfony\Component\Security\Core\User\User: plaintext 
    role_hierarchy: 
     ROLE_ADMIN: [ROLE_USER] 
    providers: 
     chain_provider: 
     chain: 
      providers: [in_memory] 
     in_memory: 
     memory: 
      users: 
      admin: {password: pass, roles: ROLE_ADMIN} 
    firewalls: 
     main: 
     pattern: /.* 
     form_login: 
      login_path: /login 
      check_path: /login_check 
      default_target_path:/
     logout: 
      path: /logout 
      target:/
     security: true 
     anonymous: true 


    access_control: 
     - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY } 
     - { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY } 

回答

1

你需要檢查你的Symfony2的應用程序和文檔

+0

喔版本的版本。是的..它的作品..非常感謝你拯救我的一天.. :) – Shahjalal 2014-12-13 19:32:32

相關問題