Created
February 15, 2013 17:21
-
-
Save phalcon/4961874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RobotsController extends Phalcon\Mvc\Controller | |
{ | |
public function index() | |
{ | |
echo "Hello Index"; | |
} | |
public function show($id) | |
{ | |
echo "Hello Show $id"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$loader = new \Phalcon\Loader(); | |
$loader->registerDirs(array('controllers/'))->register(); | |
$app = new Phalcon\Mvc\Micro(); | |
$robotsController = new RobotsController(); | |
//Retrieves all robots | |
$app->get('/', array($robotsController, 'index')); | |
$app->get('/robots', array($robotsController, 'index')); | |
$app->get('/robots/show/{id}', array($robotsController, 'show')); | |
$app->handle(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but we cannot use service from $di in controller, Im already done with that.. still not work to access $this->response or $this->request from controller ....