Zend framework Zend框架文档根目录设置

Zend framework Zend框架文档根目录设置,zend-framework,Zend Framework,我的问题也许很容易解决,但我真的无法解决 我按照《开始Zend框架》一书中的说明创建了一个新项目。 该项目有两个控制器“帐户”和“艺术家”。以下是/应用程序的树状图: . ├── application │   ├── Bootstrap.php │   ├── configs │   │   └── application.ini │   ├── controllers │   │   ├── AccountController.php │   │   ├── ArtistController

我的问题也许很容易解决,但我真的无法解决

我按照《开始Zend框架》一书中的说明创建了一个新项目。 该项目有两个控制器“帐户”和“艺术家”。以下是/应用程序的树状图:

.
├── application
│   ├── Bootstrap.php
│   ├── configs
│   │   └── application.ini
│   ├── controllers
│   │   ├── AccountController.php
│   │   ├── ArtistController.php
│   │   ├── ErrorController.php
│   │   └── IndexController.php
│   ├── models
│   └── views
│       ├── helpers
│       └── scripts
│           ├── account
│           │   ├── activate.phtml
│           │   ├── index.phtml
│           │   ├── new.phtml
│           │   └── success.phtml
│           ├── artist
│           │   ├── index.phtml
│           │   └── list-all-artists.phtml
│           ├── error
│           │   └── error.phtml
│           └── index
│               └── index.phtml
例如,如何将文档根目录设置为访问/account/new.phtml?(键入127.0.0.1时,我可以看到默认的索引页面“欢迎使用Zend Framework!”,但我不知道如何访问其他页面)

更多信息: +)文档根为/../public/(其中包含.htacess和index.php) +)127.0.0.1/index也会返回该页面,但127.0.0.1/index/index.phtml不起作用。
,返回404错误。

欢迎来到ZF!我个人经常做的一件事就是设置Vhost,而不仅仅是使用标准的“
localhost
”。这确实有助于管理单独的项目,并允许您将其存储在更方便的位置

如果您尝试使用localhost/account,会发生什么?如果您遇到任何类型的错误,那么您没有正确设置Apache。下面是我使用的示例
Vhost

<VirtualHost *:80>
   ServerName project.local
   DocumentRoot "C:\xampp\htdocs\project\public"


   # This should be omitted in the production environment
   SetEnv APPLICATION_ENV development

   <Directory "C:\xampp\htdocs\project\public">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>

</VirtualHost>

ServerName project.local
DocumentRoot“C:\xampp\htdocs\project\public”
#在生产环境中应该忽略这一点
SetEnv应用程序\环境开发
选项索引多视图跟随符号链接
允许超越所有
命令允许,拒绝
通融
继续并尝试做类似的事情,在
主机
文件中创建相应的行,清除缓存,然后应该设置


另外,在您的结构中,我注意到您缺少一个
public
文件夹。确保您有一个,还有一个
.htaccess
要重写到
index.php
。编辑:刚刚看到您的编辑,您应该已经处理好了。

在阅读任何教程或书籍之前,首先要做的事情:。这将帮助您了解Zend框架的基本工作原理。我尝试了您的建议,但问题似乎没有得到解决。请查看此配置是否正确:(谢谢!)
code
NameVirtualHost*:80 ServerName hello.local DocumentRoot“C:\Apache\htdocs\helloworld\public”SetEnv APPLICATION\u ENV“development”DirectoryIndex.php允许超出所有订单允许,deny Allow from all
code
与以前一样,给出文件“C:\Apache\htdocs\helloworld\application\views\scripts\index\index.phtml”的内容,但给出“Not Found”@user1046862您忘记了目录声明中的
FollowSymlinks
。这在使用ZF时很重要,因为所有请求都通过
index.php
路由。我知道您在使用windows,使用vhosts时不要忘记更新您的
Hosts
文件。这将为如何为ZF构建vhost提供很好的建议,它的目标是Zend Server,但应该可以轻松地适应使用apache的任何服务器。最后,我尝试了Zend Server CE,它成功了!谢谢大家的回答和评论。