Giter VIP home page Giter VIP logo

Comments (7)

peter279k avatar peter279k commented on August 22, 2024 1

Maybe it's your sever configuration problem and you should add .htaccess on your project root folder.

If you want to share SFTP access to me, please email me, thanks :).

from php-router.

peter279k avatar peter279k commented on August 22, 2024

Sorry. I run your PHP codes and it's worked successfully.

Here are my code snippets:

<?php

require 'path/to/vendor/autoload.php';

use Buki\Router;

$router = new Router();

$router->pattern(':key', '[a-z0-9]+');
$router->pattern(':oferta', '[a-z0-9.-]+');

$router->get('oferta/:key/:oferta', function($key, $nombre) {
    return 'key, oferta route with custom patterns';
});

$router->run();

from php-router.

NeftaliAcosta avatar NeftaliAcosta commented on August 22, 2024

Sorry. I run your PHP codes and it's worked successfully.

Here are my code snippets:

<?php

require 'path/to/vendor/autoload.php';

use Buki\Router;

$router = new Router();

$router->pattern(':key', '[a-z0-9]+');
$router->pattern(':oferta', '[a-z0-9.-]+');

$router->get('oferta/:key/:oferta', function($key, $nombre) {
    return 'key, oferta route with custom patterns';
});

$router->run();

Do you think it is a php or my server configuration problem?
On localhost if it works, it is probably that, but I don't know what the technical requirements of the plugin are.

I can share you SFTP access if necessary. :/

from php-router.

peter279k avatar peter279k commented on August 22, 2024

Here is my router configuration:

$params = [
    'paths' => [
        'controllers' => 'controllers/',
    ],
    'namespaces' => [
        'controllers' => 'Controllers\\',
    ],
    'base_folder' => __DIR__,
    'main_method' => 'main',
];

$router = new Router($params);

I have no middleware to use on this application.

from php-router.

izniburak avatar izniburak commented on August 22, 2024

@NeftaliAcosta , Do you still have any problem about that?

from php-router.

NeftaliAcosta avatar NeftaliAcosta commented on August 22, 2024

Do you still have any problem about that?

Hi, Thanks for your time. Yes, all the Middleware routes still do not work for me, I keep testing my site.

Is it normal that I have to comment on this part of the code for the plugin to work on my site in Router.php?

 /**
     * Run Routes
     *
     * @return void
     * @throws
     */ 
    public function run()
    {
        $base = str_replace('\\', '/', str_replace($this->documentRoot, '', $this->runningPath));
        $uri = rtrim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
        /*
        if ($_SERVER['REQUEST_URI'] !== $_SERVER['PHP_SELF']) {
            $uri = str_replace(dirname($_SERVER['PHP_SELF']), '', $uri);
        }

        if (($base !== $uri) && (substr($uri, -1) === '/')) {
            $uri = substr($uri, 0, (strlen($uri) - 1));
        }
        */
}

from php-router.

izniburak avatar izniburak commented on August 22, 2024

Could you share $_SERVER variable values by using var_dump or something else?
We should debug that problem on your side because i couldn't reproduce the problem on my side. (local and prod)

from php-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.