登錄後,我是新來ZF2,我跟着一個認證教程,我發現這裏:https://samsonasik.wordpress.com/2013/05/29/zend-framework-2-working-with-authenticationservice-and-db-session-save-handler/顯示的用戶名在ZF2
登錄後,我跟着他就如何指令(在評論區)使用$this->identity()
//config/module.config.php ....
'service_manager' => array(
'factories' => array(
'AuthStorage' => 'SanAuthWithDbSaveHandler\Factory\Storage\AuthStorageFactory',
'Zend\Authentication\AuthenticationService' => 'SanAuthWithDbSaveHandler\Factory\Storage\AuthenticationServiceFactory',
),
),
但它生成此錯誤:
"Uncaught exception 'Zend\ServiceManager\Exception\InvalidServiceNameException' with message 'A service by the name or alias "Zend\Authentication\AuthenticationService" already exists and cannot be overridden; please use an alternate name' in C:\xampp1\htdocs\zf2\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php: "
請誰能幫助我!
我已經試過了,還是同樣的錯誤。我不知道我做錯了什麼。肯定有東西 –
你試過重命名你的服務嗎? –
不!你可以租賃告訴我更多細節嗎?我是否將其重命名爲「module.config.php?」 –