altorouter

Alto Router not working for controllers

陌路散爱 提交于 2020-01-15 10:15:28
问题 I am trying pass controller name and method to Alto Router map method but it doesnt work in index.php i have following code <?php require_once 'vendor/autoload.php'; use Route\AltoRouter; use App\Controllers\HomeController; $router = new AltoRouter(); $router->setBasePath('demo/'); $router->map('GET','/', 'HomeController#index'); $router->map('GET', '/php', function(){ echo 'It is working'; }); $match = $router->match(); // call closure or throw 404 status if( $match && is_callable( $match[

Alto Router not working for controllers

。_饼干妹妹 提交于 2020-01-15 10:15:03
问题 I am trying pass controller name and method to Alto Router map method but it doesnt work in index.php i have following code <?php require_once 'vendor/autoload.php'; use Route\AltoRouter; use App\Controllers\HomeController; $router = new AltoRouter(); $router->setBasePath('demo/'); $router->map('GET','/', 'HomeController#index'); $router->map('GET', '/php', function(){ echo 'It is working'; }); $match = $router->match(); // call closure or throw 404 status if( $match && is_callable( $match[

Emulating Node/Express Routes in .htaccess

纵饮孤独 提交于 2019-12-12 05:09:02
问题 I have been trying to emulate how nodejs/express work with their routes. I am forwarding all traffic to index.php to process routes (using AltoRouter). My file struture is something like this: -/ --public/ |- assets |- ... --routes/ |- route.php |- ... --index.php Take these urls for instance (all should return/redirect 404): http://testsite.com/routes http://testsite.com/routes/route.php http://testsite.com/somefile.php However only assets should be directly accessible like so (I dont want

AltoRouter not doing the routing correctly

∥☆過路亽.° 提交于 2019-12-11 17:56:46
问题 I'm just developing a little WebApp with PHP and for routing, I use AltoRouter. So far, I was only developing and testing offline, so on my localhost. Now, to see the behaviour on a server, I uploaded my code, fixed the database connection to fit for the MySQL-Server running on the server (which is Ubuntu 14.04) and tried to get it started. First, what I'm doing for the routing, is a simple .htaccess , looking like that: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f

AltoRouter send Mime Type

荒凉一梦 提交于 2019-12-11 05:18:22
问题 I'm using AltoRouter to route my urls to the correct files. Now basically here, I describe my problem already. On one page, I have an alert included, styled by bootstrap. It's defined as simple as that: $('#wrongPasswordDiv').html('<br/><div class="alert alert-danger" id="wrongPWAlert" role="alert">Falsches Passwort. Bitte erneut versuchen!</div>'); Also, before, Bootstrap css file is included: <link rel="stylesheet" type="text/css" href="/bootstrapcss" /> bootstrapcss is routed to the

Altorouter can't execute routes

丶灬走出姿态 提交于 2019-12-08 06:09:41
问题 I am using Altorouter in a basic PHP App(No framework) but somehow it's not working. Below are details: index.php <?php error_reporting(E_ALL); ini_set('display_errors',1); require_once __DIR__ . '/vendor/autoload.php'; $router = new AltoRouter(); $router->map( 'GET', '/', function() { include __DIR__ . 'home.php'; }); print "Done"; It prints Done and no error in php log. htaccess RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] I am access it as `http:/

Altorouter can't execute routes

自古美人都是妖i 提交于 2019-12-08 05:08:33
I am using Altorouter in a basic PHP App(No framework) but somehow it's not working. Below are details: index.php <?php error_reporting(E_ALL); ini_set('display_errors',1); require_once __DIR__ . '/vendor/autoload.php'; $router = new AltoRouter(); $router->map( 'GET', '/', function() { include __DIR__ . 'home.php'; }); print "Done"; It prints Done and no error in php log. htaccess RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] I am access it as ` http://localhost/home/myapp/ Ok I figured out the issue. The URL I want to access is: http://localhost/home/myapp/