hi, sorry, Im still dont know about my situation. Sorry about my grammar first..
I want my controller use service from micro, like response, request etc, but I cant do that in my controller.
I define loader Micro Apps like this :
<?php
$loader = new \Phalcon\Loader();
use Phalcon\Mvc\Micro;
/**
- We're a registering a set of directories taken from the configuration file
*/
$loader->registerDirs(
[
$config->{APP_ENV}->application->controllersDir,
$config->{APP_ENV}->application->modelsDir,
$config->{APP_ENV}->application->libraryDir,
]
)->register();
/**
- Handle the request
*/
$app = new Micro($di); // micro API
$app->get('/', function () use ($app) {
$app->response->setContentType('application/json', 'UTF-8');
$app->response->setJsonContent(array(
"status" => "OK",
'message' => "Welcome to CNN APIS",
));
$app->response->send();
});
My problem is here $app->get("/newsfeed/{kanal}", ['NewsfeedController', "indexAction"]); . When I want to use :
$app->response->setJsonContent(array(
"status" => "OK",
'message' => "Welcome to CNN APIS",
));
My controller said, I can't find object like response, request etc. How to use $app object in my controller ?
thx ...