2017-04-02 78 views
0

共享控制器這是我的路徑:自動加載在HMVC笨應用

/api 
    calltek 
     application 
      config 
      controllers 
      ...etc 
     index.php 
     .htaccess 
    empresite 
     application 
      config 
      controllers 
      ...etc 
     index.php 
     .htaccess 
    gestios 
     config 
     controllers 
      Gestios_login.php 
      Gestios_profile.php 
     libraries 
     models 
    shared 
     config 
     helpers 
     language 
     libraries 

Gestios和共享是包。 Calltek和Gestios是應用程序。

Calltek autoload.php負載從gestios資源共享

$autoload['packages'] = array(APPPATH.'../../gestios',APPPATH.'../../shared'); 

在我routes.php文件我定義路徑調用Gestios控制器:

$route['auth'] = 'gestios_login/index'; 
$route['avatar'] = 'gestios_profile/avatar'; 
$route['profile/me'] = 'gestios_profile/me'; 
$route['profile/avatar'] = 'gestios_profile/avatar'; 
$route['profile/avatar/(:num)'] = 'gestios_profile/avatar/$1'; 
$route['profile/config'] = 'gestios_profile/config'; 

當我嘗試導航到example.com/api/calltek/auth應用程序發送給我一個404.

我calltek htaccess的它的優良:

RewriteEngine on 

RewriteCond $1 !^(index\.php|media) 
RewriteRule ^(.*)$ index.php/$1 [L] 

回答

0

案例笨不autload德控制器的作爲包(LINK)我發現和替代解決方案:

只需創建一個第二控制器和擴展共享控制器:

<?php defined('BASEPATH') OR exit('No direct script access allowed'); 

require APPPATH.'/../../gestios/controllers/Gestios_login.php'; 

class Auth extends Gestios_login { 
    public function __construct(){ 
     parent::__construct(); 
    } 
}