M
M
Mikhail Sokolov2019-04-22 08:50:12
Phalcon
Mikhail Sokolov, 2019-04-22 08:50:12

Why is the route not working in Phalcon?

I am mastering the Phalcon framework in order to use it for REST. But, it seems from scratch, there was a problem with setting up routing.
Created a simple script:
/dev/rest/reports/index.php

<?
use Phalcon\Mvc\Micro;
$app = new Micro();
echo 1;
$app->get(
   '/',
   function () {
      echo 2;
   }
);
$app->handle();

Htaccess for it:
/dev/rest/reports/.htaccess:
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

But, when accessing (both through the browser and through the console with the curl -i -X ​​GET command) to the
/dev/rest/reports/ address, it
returns "1" instead of "12".
Why doesn't the $app->get() construct work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Sokolov, 2019-04-23
@sokolov-m

As a result, it turned out to be the version of the module. It was version 4.0.0-alpha.3.
After downgrading to 3.4.3 the code worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question