首先,我是新手。我在我的wamp服务器successley中安装了zend框架。我的包含路径如下:
include_path ="。; E:\ wamp \ bin \ php \ zend_framework \ library"
我创建了一个项目名称" mehedi"。但是当我浏览到mehedi / application /目录中的Bootstrap.php文件时,它显示以下错误:
Fatal error: Class 'Zend_Application_Bootstrap_Bootstrap' not found in E:\wamp`\www\mehedi\application\Bootstrap.php on line 4`
当我浏览除mehedi / public / index.php之外的其他php文件时,它会显示一些致命错误。
一切顺利还是错过了重要的事情。
以下是mehedi / application / configs / application.ini文件中的应用程序配置:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
答案 0 :(得分:1)
如果使用Zend_Tool命令行界面设置应用程序,它会将.htaccess
文件放在公用文件夹中,这是默认设置。
您所描述的这种行为是可以预期的。 ZF MVC通过index.php文件路由所有请求(图像,css和javascript等资源除外)。因此,如果您可以直接转到Bootstrap.php
文件,那么您会担心。
ZF中的所有网址都应采用www.example.com/moduleName/controllerName/actionName
格式,并且可以根据需要附加参数。另请注意,moduleName
是可选的,如果没有controllerName
与路线匹配,则默认为moduleName
。
要测试您的安装,请使用以下网址:mehedi/public/index/
,您应该会看到默认的欢迎屏幕。当您添加控制器和操作时,您将自动添加新的URL路由。
[编辑]
例如,如果添加一个名为AdminController
的控制器(如果使用Zend_Tool添加它,它将自动使用indexAction()构建)。您将自动使用AdminController/indexAction
的网址路由到www.mehedi.com/admin/index
,这样就可以了。 (在大多数应用程序中,索引被指定为默认操作,因此www.mehedi.com/admin
将获得相同的结果)
P.S。帮自己一个忙,设置virtul host让生活变得如此轻松
这里有一个你的vhost可能是什么样子的例子,如果你打算使用它,将localhost声明为第一个vhost很重要。
httpd-vhosts.conf with Include conf/extra/httpd-vhosts.conf enabled in httpd.conf
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "C:\Zend\Apache2/htdocs" #I use Zend server, make this match your wamp setup
ServerName localhost
#directory settings for localhost are typically defined in httpd.conf
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "E:/wamp/www/mehedi/public"
ServerName www.mehedi.com
ErrorLog "path/to/your/log/file"
<directory "E:/wamp/www/mehedi">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
重要的是要记住这种vhost设置旨在用于本地开发机器或内部网络服务器,除非你真的知道自己在做什么,否则你不希望在生产服务器上执行此操作。