We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problem with URLs without Mod-Rewrite

Code

<?php

use Phalcon\Mvc\Url;

$url = new Url();

//Pass the URI in $_GET["_url"]

$url->setBaseUri('/invo/index.php?_url=/');

//This produce: /invo/index.php**?_url=/products/save?page=1**

echo $url->get("products/save", ['page' => 1]);

Use

$url->get(['for' => 'your-route-name', 'page' => 1]);


691

router is default, not set anything

Sorry, I misunderstood your problem, to append arguments I've extended Phalcon\Mvc\Url:

<?php

    public function get($uri = NULL, $args = NULL, $local = NULL) {
        $url = rtrim(parent::get($uri, NULL, $local), '/');

        if (NULL !== $args) {
            $query = http_build_query($args);

            if (! empty ($query)) {
                $url .= (strpos($url, '?') ? '&' : '?') . $query;
            }
        }

        return $url;
    }