phalconphalcon-routing

phalcon router not despatching


I have this in the top of my index.php:

<?php
use Phalcon\Loader;
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Application;
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Mvc\Router;

define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');

/*
if (isset($_GET['_url'])) {
        var_dump($_SERVER["REQUEST_URI"]);
        var_dump($_GET['_url']);
        die();
}
*/

// Create the router
$router = new Router();

// Define a route
$router->add(
    '/signup',
    [
        'controller' => 'signup',
        'action'     => 'index',
    ]
);
$router->handle(
    $_SERVER["REQUEST_URI"]
);

no matter what I do, any attempt to access /signup just takes me to index/index. You will notice the isset check - that is reporting that the correct parameter ( /signup ) is being passed, but the routing isn't happening. Note the explicit route for testing. With or without that the routing doesn't happen.

Any idea what's happening? Thanks.


Solution

  • found it, there was a random 1 in the line

    $response = $application->handle();