20,359
社区成员
发帖
与我相关
我的任务
分享
<?php
namespace app\user\controller;
class User
{
public function Login()
{
return "登录";
}
}
Exception in Loader.php line 349
class [ app\user\controller\Login ] not exists
public function home()
{
return 'home page';
}
Exception in Loader.php line 349
class [ app\index\controller\Home ] not exists
<?php
namespace app\index\controller;
class Index
{
public function index()
{
return '省略。。。';
}
public function home()
{
return 'home page';
}
}
应该不是这个问题 我尝试加了extends Controller 也是同样错误
index是原来框架提供的
http://127.0.0.1:8096/public/index.php/index/index 可以正常访问
home()是我添加的 访问http://127.0.0.1:8096/public/index.php/index/home 就报错
Exception in Loader.php line 349
class [ app\index\controller\Home ] not exists
$class = self::parseClass($module, $layer, $name);
if (class_exists($class)) {
$action = new $class;
$_instance[$name . $layer] = $action;
return $action;
} elseif ($empty && class_exists($emptyClass = self::parseClass($module, $layer, $empty))) {
return new $emptyClass;
} else {
//这里抛出异常
throw new Exception('class [ ' . $class . ' ] not exists', 10001);
}
}
class Login
{
public function Login()
{
return "登录";
}
}
或class Login extends Controller
{
public function Login()
{
return "登录";
}
}