无法路由 Class 'think\Controller' not found

浏览:2958 发布日期:2018/04/02 分类:求助交流 关键字: 路由 think\Contorller
纯新手,麻烦问下。
从public/index.php(以下的代码)<?php
namespace app\index\controller;

class Index
{
    public function index()
    {
        echo "您好: " . cookie('user_name') . ', <a href="' . url('login/loginout') . '">退出</a>';
    }
}
进去后点退出按钮 会提示
The requested URL /index/login/loginout.html was not found on this server.而并没有执行login页中的loginout方法(下面的代码),<?php
namespace app\index\controller;
use think\Controller;
class Login extends Controller
{
    public function index()
    {
        return $this->fetch();
    }
    // 处理登录逻辑
    
    // 退出登录
    public function loginOut()
    {
        cookie('user_id', null);
        cookie('user_name', null);

        $this->redirect(url('login/index'));
    }
}
这是为什么啊?老师说是我配置有问题所以无法路由?
一样的代码在同学电脑上确实是可以运行的,所以真的是配置出错了?
但是完全不知道为什么会这样。
并且用phpstorm运行controller/Login.php会提示think\Contorller not found。

最佳答案
评论() 相关
后面还有条评论,点击查看>>