【发布时间】:2015-11-25 22:09:56
【问题描述】:
我阅读了此处发布的所有问题,但找不到解决问题的方法。
我有 Windows 7、xampp、apache 2.4、php 5.6、zend 框架 2
我创建了一个名为 Application 的示例应用程序
这是我的 .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
我的配置文件是这样的
'translator' => array(
'locale' => 'en_US',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'controllers' => array(
'invokables' => array(
'Application\Controller\Login' => 'Application\Controller\LoginController',
'Application\Controller\Index' => 'Application\Controller\IndexController'
),
),
http://localhost:8080/lizziap/ 这个可行
localhost:8080/lizziap/Index 这不起作用
localhost:8080/lizziap/Login 这不起作用
localhost:8080/索引这不起作用
找不到页面。 请求的 URL 无法通过路由匹配。
没有可用的例外
我将非常感谢任何帮助...谢谢!
这就是配置现在的样子,并且可以正常工作
'router' => array(
'routes' => array(
'login' => array(
'type' => 'segment',
'options' => array(
'route' => '/login[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id'=>'[0-9a-zA-Z]*',
),
'defaults' => array(
'controller' => 'Application\Controller\Login',
'action' => 'login',
),
),
),
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
【问题讨论】:
标签: php zend-framework