-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter Patterns #10
Comments
@dukinfotech, thank you for your reply. I can use the parameter pattern successfully. Here is my sample code: <?php
require __DIR__ . '/../../vendor/autoload.php';
use Buki\Router;
$params = [
'paths' => [
'controllers' => 'controllers/',
],
'namespaces' => [
'controllers' => 'Controllers\\',
],
'base_folder' => __DIR__,
'main_method' => 'main',
];
$router = new Router($params);
$router->get('/', function() {
return 'Hello World!';
});
$router->get('/{s}', function() {
return 'parameter pattern';
});
$router->get('/controllers', 'TestController@main');
$router->run(); You can save this file named I use the Can you reproduce issue? Thanks. |
I find out why it not working. My project is subdir: htdocs/mvc-base. But i don't know how to fix |
@dukinfotech, you have to change the original web document root to And it will be worked fine. It looks like you use the XAMPP server? Please look at this reference. |
What happens with other project in htdocs folder if changing xampp document root. I just want to use for mvc-base project. Does it overide by .htaccess file or some php code? |
@dukinfotech Are you sure that you set base_folder value in configuration parameters correctly? |
@izniburak, I think it's not related to the This issue is about the To solve this issue, it should have the build/deployment tutorial. |
BTW, I also deploy this router with Apache server on Linux Ubuntu 16.04 successfully. It's about the internal Apache setting, including |
I guess so. Rewrite module must be enable for Apache on the server. After that, .htaccess file must be add. Documentation may help to you. I just made a new test to make sure. No problem occurred. |
Tks all!. My problem's about .htaccess file. I just copy content of .htaccess file. But now i need tutorial for setting multi folder controller? frontend/controllers and backend/controllers. How to do that? |
@dukinfotech You can not do like this. But you can try to do this:
And you should add namespace definition in your controller classes. For example: # this class in controllers/frontend
namespace Controller\Frontend;
class HomeController {
//
}
# this class in controllers/backend
namespace Controller\Backend;
class HomeController {
//
} Finally, you can update Route definition like this: $route->get('/backend-home', 'Backend.HomeController@main');
$route->get('/frontend-home', 'Frontend.HomeController@main'); |
Hi izniburak, thank your contribution for our community. I try using parameter patterns feature. But it not working. It shows Object not found!. URL: '/' is working perfectly. Thank
$router->get('/', function() {
echo 'Home';
});
$router->get('/{s}', function($value)
{
echo 'Hello, ' . $value;
});
The text was updated successfully, but these errors were encountered: