Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Zend Framework自定义路由设置_Php_Zend Framework_Frameworks_Routes - Fatal编程技术网

Php Zend Framework自定义路由设置

Php Zend Framework自定义路由设置,php,zend-framework,frameworks,routes,Php,Zend Framework,Frameworks,Routes,大家好 我正在学习Zend框架:初学者指南第3章,我在Square/form/form\u example.php中有一个form\u示例类,它基本上有一个表单 模块/default/controllers/ExampleControllers.php将对其进行初始化。然而,我建立了 Zend2 Sources Files Application modules default controllers

大家好 我正在学习Zend框架:初学者指南第3章,我在Square/form/form\u example.php中有一个form\u示例类,它基本上有一个表单

模块/default/controllers/ExampleControllers.php将对其进行初始化。然而,我建立了

Zend2 
  Sources Files
     Application
        modules 
            default
               controllers 
                   ExampleController.php
               views
                   scripts 
                      form 
                         index.phtml

        library
          square
             form
                Form_Example.php
在application.ini中

我进去的时候(http://localhost/zend2/public/example),它返回一个未找到的页面结果,请帮助我,以便在Form_示例中显示我创建的表单


谢谢,非常感谢

我使用一个单独的路由文件,使用这种格式,并称之为routes.ini

resources.router.routes.example.route = /example
resources.router.routes.example.defaults.module = default           
resources.router.routes.example.defaults.controller = form
resources.router.routes.example.defaults.action = form 
在引导过程中,您需要以下内容:

routes.example.route = /example
routes.example.defaults.module = default           
routes.example.defaults.controller = form
routes.example.defaults.action = form 

我发现,使用不同的路由文件可以降低我的主.ini文件的复杂性,并且更容易理解。

您是否在引导程序中向ZF介绍了路由文件?是否启用了错误和警告以查看实际错误?
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();     
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');      
$router->addConfig($config,'routes');