1
大家好我每次嘗試登錄後,我已成功地將用戶數據添加到數據庫,但登錄不工作,我是cakephp.Please新來幫助我。 這裏是代碼
的AppController:
class AppController extends Controller {
public $components = array(
'DebugKit.Toolbar' ,'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'users', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login')
)
);}
UsersController:
public function login(){
if ($this->request->is('Post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
}//$this->Flash->error(__('Invalid username or password, try again'));
}
}
login.ctp:
<?php
echo $this->Form->create('User');
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->end('login');
>
你得到了什麼錯誤信息? – JayIsTooCommon
我有dubug $ this-> Auth-> login(),它返回false。 –
我應該改變cakephp版本還是別的?任何幫助請 –