SHARE
TWEET

Untitled

a guest Aug 12th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. Route::set('admin', function($uri) {
  3.         $uri = explode('/', $uri);
  4.         // Base Controller_Admin
  5.         if (count($uri) == 1) {
  6.             return array(
  7.                 'controller' => 'admin',
  8.                 'action'     => 'index',
  9.             );
  10.         }
  11.  
  12.         // These all reside in /admin/
  13.         return array(
  14.             'directory'  => 'admin',
  15.             'controller' => (!empty($uri[1]) ? $uri[1] : 'admin'),
  16.             'action'     => (!empty($uri[2]) ? str_replace('-', '_', $uri[2]) : ''),
  17.             'id'         => (count($uri > 2) ? implode('/', array_slice($uri, 3)) : ''),
  18.         );
  19.     },
  20.     '<directory>/<controller>(/<action>(/<id>))'
  21. );
RAW Paste Data
Top