CodeIgniter default controller in a sub directory not working

前端 未结 9 1680
醉话见心
醉话见心 2020-11-29 10:15

My default_controller in the routes configuration is set as \"home.php\".

I have a sub directory for my controllers, lets call it \"folder\". So if I visit http://my

9条回答
  •  长情又很酷
    2020-11-29 11:20

    MY FOLDER STRUCTURE

    --controllers
      --backend
      --frontend
        --home.php
        --products.php
        --productDetail.php
    --homeIndex.php
    

    In config/routes.php

    $route['default_controller'] = 'homeIndex';
    $route['frontend'] = 'frontend/home';
    $route['backend'] = 'backend/home';
    

    In controllers/homeIndex.php

    action();
        }    
    }
    

    by default homeIndex will be loaded and from homeIndex i call to frontend/home/action function.

提交回复
热议问题