我在xampp中创建了一个虚拟主机:www.attila-naghi.ro。我把我的项目放在那里,它工作得很好。现在我想把它放在一个托管服务器上。我观察到我的 css 和 js 没有加载,如果我访问控制器,我会得到 404。这是网址。谁能帮我?感谢
这是我的模块.php文件:
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend'Mvc'Router'Http'Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application'Controller'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '[:controller[/:action]][/:param1]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
),
'defaults' => array(
'action' => 'index',
'__NAMESPACE__' => 'Application'Controller',
// 'param1' => 'tralala'
)
)
)
)
),
),
),
'service_manager' => array(
'abstract_factories' => array(
'Zend'Cache'Service'StorageCacheAbstractServiceFactory',
'Zend'Log'LoggerAbstractServiceFactory',
),
'aliases' => array(
'translator' => 'MvcTranslator',
),
),
'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'Index' => 'Application'Controller'IndexController',
'Application'Controller'Create' => 'Application'Controller'CreateController',
'Application'Controller'Blog' => 'Application'Controller'BlogController',
'Application'Controller'Portofolio' => 'Application'Controller'PortofolioController',
'Application'Controller'User' => 'Application'Controller'UserController',
),
),
'view_manager' => array(
'base_path' => 'http://www.attila-naghi.com/',
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
// Placeholder for console routes
'console' => array(
'router' => array(
'routes' => array(
),
),
),
);
如果你看一下骨架应用程序,你可以看到/public
目录。这些内容应该进入服务器的公共目录。例如,对于带有cPanel的服务器,它是 public_html
。其他托管服务器可能有 www
,或其他内容。
我最近上传了一个 zend 骨架应用程序,完全按照上面做,它运行得很好。如果您想知道如何处理原始(骨架)目录/public
- 我将其与public_html
一起保留,但您可以将其删除,因为它是空的。