我在我的网站上使用CakePHP Auth组件。代码在Windows中运行良好,但在将其上传到linux在线主机后,它会给出消息 未找到授权适配器“操作”。 CakePHP的
关于这个问题的任何想法?
<?php
App::uses('AppController', 'Controller');
class AppController extends Controller {
public $mobile;
public $components = array(
'Acl',
'Auth' => array(
'authorize' => array(
'Actions' => array('actionPath' => 'controllers/'),
),
),
'Session',
'RequestHandler',
);
public $helpers = array('Html', 'Form', 'Session', 'Js' => array('Jquery'));
public function beforeFilter() {
parent::beforeFilter();
// print_r($this->request); die;
if ($this->request->is('post') && isset($this->request['data']['access_token'])) {
App::uses('User', 'Model');
$this->User = new User();
// print_r($this->request['data']['access_token']);die;
$this->mobile = $this->User->authenticateMobile($this->request['data']['access_token']);
}
// print_r('APPCONT');
// print_r($this->request);
// die;
$this->Auth->authenticate = array(
AuthComponent::ALL => array('userModel' => 'User'),
//'ChangeEg',
'Form'
);
//Configure AuthComponent
$this->Auth->authorize = 'actions';
$this->Auth->loginError = "Wrong credentials";
$this->Auth->authError = "This part of the website is protected.";
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'feedbacks', 'action' => 'add');
$this->Auth->logoutRedirect = array('controller' => 'home', 'action' => 'index');
}
}
答案 0 :(得分:2)
我有同样的问题,是CamelCased的错误,
而是写$ this-&gt; Auth-&gt; authorize ='Controller';
我写了$ this-&gt; Auth-&gt; authorize ='controller'。
在Windows中运行正常,但在Linux中没有。
请参阅此帖子https://groups.google.com/forum/?fromgroups#!topic/cake-php/wZGFoJ4ayx0