我已经搜索了stackoverflow,确实有很多关于这个错误的问题,但是对于我的生活,我不能看到我做错了什么。
$routes->get('/', '/User_Public/Home::index');
$routes->get('about-us', '/User_Public/Home::aboutUs');
$routes->get('contact-us', '/User_Public/Home::contactUs');
下面是我的目录结构:
这是应用程序/控制器/User_Public/Home的内容〈?php
namespace App\Controllers\User_Public;
use App\Controllers\User_PublicController;
use App\Models\UserModel;
class Home extends User_PublicController
{
public function __construct()
{
// run the parent's contruct
parent::__construct();
}
public function index()
{
//$this->cachePage(DAY);
// .= will add to exisiting css files.
$this->data['user_public_css'] .= '<!-- user_public_css extened -->
<link rel="stylesheet"
href="'.base_url().'/user_public/theme/bs4/css/carousel.css">';
$this->data['active_menu'] = '';
return view('user_public/home/index', $this->data);
}
public function aboutUs()
{
//$this->cachePage(DAY);
$this->data['active_menu'] = 'aboutUs';
return view('user_public/aboutUs/index', $this->data);
}
public function contactUs()
{
$this->data['active_menu'] = 'contactUs';
return view('user_public/contactUs/index', $this->data);
}
}
这就是错误;
Fatal error: Cannot declare class
App\Controllers\User_Public\Home, because
the name is already in use in/var/www/XXXXXXXdomain/api.example.com/app_dir/app/Controllers/User_Public/Home.php on line 0
感谢您的指点。
1条答案
按热度按时间dsekswqp1#
检查控制器“App\Controllers\User_PublicController”以查看其是否扩展任何名为“Home”的控制器,或检查基本控制器是否扩展任何名为“Home”的控制器