无法访问 Zend Framework 中的控制器和操作 [英] Can't access controller nore action in Zend Framework

查看:27
本文介绍了无法访问 Zend Framework 中的控制器和操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Zend Framework 项目中,我有以下基本 URL

In my Zend Framework project I have the following base URL

http://domain/~myFolder

如果我像这样访问它,我可以毫无问题地访问 indexAction 但如果我尝试像这样显式访问它:

If I access it like so, I can access the indexAction with no problem but if I try to access it explicitly like so:

http://domain/~myFolder/index 

我不能,也不能访问不同的控制器或操作.它总是说

I can't, nore can I access different controllers or actions. It always says

/public/index.php was not found on this server.

如何访问项目中的不同控制器和操作?我需要添加路线吗?

How can I access the different controllers and actions in my project? Do I need to add a route?

推荐答案

根据...更改.htaccess文件的内容

Change the contents of the .htaccess file according to...

来自:http://framework.zend.com/manual/1.12/en/zend.application.quick-start.html

您可能会注意到应用程序环境常量值查找环境变量APPLICATION_ENV".我们建议设置这个在您的 Web 服务器环境中.在 Apache 中,您可以在您的虚拟主机定义,或在您的 .htaccess 文件中.我们推荐您的 public/.htaccess 文件的以下内容:

You may note that the application environment constant value looks for an environment variable "APPLICATION_ENV". We recommend setting this in your web server environment. In Apache, you can set this either in your vhost definition, or in your .htaccess file. We recommend the following contents for your public/.htaccess file:

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

这篇关于无法访问 Zend Framework 中的控制器和操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆