I'm getting:
A 404 error occurred
Page not found. The requested URL could not be matched by routing.
My module.config.php
file is:
'router' => array(
'router' => array(
'Test' => array(
'type' => 'Segment',
'options' => array(
//http://localhost/Test/Test
'route' => '/Test[/[:action]]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'controller' => 'Test\Controller\Test',
'action' => 'Test'
),
),
),
),
),
help please, i am new in Zend Framework 2 !
I will suggest also check the data folder that has cached config files, config files being cached in dev install also may cause this issue. delete files inside data/cache and try.
PS: if you are just starting try with blog module on zend site it is for beginners and more updated with new versions.
https://framework.zend.com/manual/2.4/en/in-depth-guide/first-module.html
Please check the .htaccess file and index.php files. If these are exist in public folder means, you have to use the url as
Your codes are almost right. Andrew has guided you well. Let me know your response.
1.You should check also
application.config.php
and add your module name into RETURN array.2.If Doesn't.Check route array in
module.config.php
Achieve fix it, I was missing the letter "d", was thus: Zend \ Loader \ StandarAutoloader I added the "d": Zend \ Loader \ StandardAutoloader. Greetings Friends. TIP: Zend Studio 10 and his version de ZF2 run perfect for this moment !
You should use configuration like Application module in ZendSkeletonApplication:
You just add the following code:
add this code to 'child-routes' key and after that you'll access to url: localhost/:controller_name/:action_name/:id (example : http://zf.dev/test/index or http://zf.dev/test/add/1). And now it's work! This code can fix error 404 for tutorial in zf2 documentation.
You have a typo, try this:
Routes rather than router twice..