相关疑难解决方法(0)

cakePHP中找不到授权适配器

当我尝试登录应用程序时,我正试图将我的代码从本地移动到服务器

在此输入图像描述

Here is my AppController
class AppController extends Controller{
    /*  Determines what logged-in users access to */
    var $components = array('Auth','Session');

    public function isAuthorized($user){
        return true;
    }

    public function beforeFilter(){
        $userdetails = array();
        $this->Auth->autoRedirect = false;
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
        $this->Auth->loginRedirect = array('controller' => 'matches', 'action' => 'index');
        $this->Auth->authorize = 'controller';
        $this->Auth->authError= 'You need permissions to access this page';
        $this->Auth->allow('users');
        $this->set('Auth',$this->Auth);
        $userdetails = $this->Auth->user();
        $this->set('myUser', $userdetails['username']);
        $this->set('myRole', $userdetails['user_role_id']);
        $this->set('pStatus', $userdetails['password_status']);
    }
}


Here is my Login …
Run Code Online (Sandbox Code Playgroud)

authentication cakephp-2.0

5
推荐指数
1
解决办法
5643
查看次数

在CakePHP 2.0中使用Html Helper时未定义的var

我第一次尝试CakePHP时收到此错误:

未定义的变量:html [APP/View/Posts/index.ctp,第13行]

我有版本2.0-alpha,我有错误的版本或再次改变了什么.好像它找不到html助手.

更多信息请求:

这是index.ctp文件

<?php foreach ($posts as $post): ?>    

<?php echo $post['Post']['id']; ?>


<?php
##line 13 here
 echo $html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); 
?>


<?php echo $post['Post']['created']; ?>

<?php endforeach; ?> 
Run Code Online (Sandbox Code Playgroud)

数据肯定是通过,但我得到的错误是在第13行:

未定义的变量:html [APP/View/Posts/index.ctp,第13行]致命错误:在/ home中的非对象上调用成员函数link()

我很新,我希望这会有所帮助.

更新5小时后变得疯狂

谢谢大家分类,如果有任何人有这个问题,主站点上的教程是旧的,没有人已经努力更新它!...在index.ctp示例中替换

$html->link(... 
Run Code Online (Sandbox Code Playgroud)

$this->Html->link(...
Run Code Online (Sandbox Code Playgroud)

php cakephp cakephp-2.0

3
推荐指数
1
解决办法
5748
查看次数

标签 统计

cakephp-2.0 ×2

authentication ×1

cakephp ×1

php ×1