Rahul's Work

include these two classes will make

Request Class :

<?php

Class Request {

    private $_controller;
    private $_method;
    private $_args;

    public function __construct(){
        $str=$_SERVER['REQUEST_URI'];
       // echo "<pre>";
        //print_r($_SERVER);
        $first_slash = strpos($str, '/');
        $second_slash = strpos($str, '/', $first_slash+1);
        $str = substr($str, $second_slash+1);
        $parts = explode('/',$str);

        //print_r($parts);
        $this->_controller = ($c = array_shift($parts))? $c: 'index';
        $this->_method = ($c = array_shift($parts))? $c: 'index';
        $this->_args = (isset($parts[0])) ? $parts : array();
    }

    public function getController(){

        return $this->_controller;

    }
    public function getMethod(){

        return $this->_method;

    }
    public function getArgs(){

        return $this->_args;
    }
}

Router Class :

Class Router{     public static function route(Request $request){         $controller = $request->getController().'Controller';         $method = $request->getMethod();         $args = $request->getArgs();         $controllerFile = dirname(__FILE__).'/controllers/'.$controller.'.php';         if(is_readable($controllerFile)){             require_once $controllerFile;             $controller = new $controller;             if(!empty($args)){                …

View original post 69 more words

Advertisements

2 thoughts on “

  1. This is a message to the admin. Your website is missing out on at least 300 visitors per day. I have found a company which offers to dramatically increase your traffic to your website: http://bag.sh/16M They offer 1,000 free visitors during their free trial period and I managed to get over 30,000 visitors per month using their services, you could also get lot more targeted visitors than you have now. Hope this helps 🙂 Take care.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s