Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
class RobotsController extends Phalcon\Mvc\Controller
{
public function index()
{
echo "Hello Index";
}
public function show($id)
{
echo "Hello Show $id";
}
}
<?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();
@prakasa1904

This comment has been minimized.

Copy link

prakasa1904 commented Oct 25, 2016

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 ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.