0

我的应用程序在 xampp 环境中正常运行,但在上传到单元测试服务器后遇到错误。

未找到

在此服务器上找不到请求的 URL /application/public/login。

模块.config.php

'router' => array(
    'routes' => array(
        'login' => array(
            'type'    => 'segment',
            'options' => array(
                'route'         => '/login',
                'constraints'   => array(
                    'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    'id'     => '[0-9]+',
                ),
                'defaults'   => array(
                    'controller' => 'loginController',
                    'action'     => 'index',
                ),
            ),
                'may_terminate' => true,
                'child_routes' => array(
                        'process' => array(
                                'type'    => 'Segment',
                                'options' => array(
                                        'route'    => '/[:action]',
                                        'constraints' => array(
                                                'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                                        ),
                                        'defaults' => array(
                                        ),
                                ),
                        ),
                ),                  
        ),
        'logout' => array(
            'type'  => 'segment',
            'options' => array(
                'route'     => "/logout",
                'defaults'  => array(
                    'controller'    => 'loginController',
                    'action'        => 'logout'
                )
            )
        ),
    ),
),      
4

1 回答 1

0

1) 'public' 目录必须指定为文件 C:\xampp\apache\conf\extra\httpd-vhosts.conf 中的根目录:

# Once for all hosts 
NameVirtualHost *:80 

# For each host
<VirtualHost *:80>
   DocumentRoot "C:/xampp/htdocs/SkeletonApplication/public"
   ServerName localhost.myapp
   <Directory "C:/xampp/htdocs/SkeletonApplication/public>
      AllowOverride All
      Order deny,allow
      Deny from all
      Allow from localhost
   </Directory>
   DirectoryIndex index.html index.php
</VirtualHost>

2) 在您的文件 C:\Windows\system32\drivers\etc\hosts 中:

127.0.0.1 localhost.myapp

3) 在您的浏览器中:

http://localhost.myapp/login

4)您的“登录”路线的类型为“文字”,而不是“段”。并且没有“约束”。

于 2013-08-13T07:47:13.323 回答