
2008-4-6 20:40
wjcx0113
讨教关于实现各种模块的问题
首先我已经实现了基本的MVC模式,能通过 .com/ 实现基本hello,world程序
现在我要实现的是 .com/blog ,./com/news 之类的模块,遇到了困难
我的目录树,ZF是1.5.0
/application
/controllers
IndexControllers.php
BlogControllers.php
/models
/ views
/scripts
/blog
index.phtml
/index
index.phtml
/ library
/zend
/Smarty
/ public
.htaccess
index.php
根据官方的文档7.3.2.2配置了参数
$front->setControllerDirectory(array(
'default' => '../application/controllers',
'blog' => '../modules/blog/controllers',
'news' => '../modules/news/controllers',
可是运行的时候,输入.com/blog 就出现404错误
请问高手:
我出现的问题在哪里?
我该如何才能正确实现这些功能?
[[i] 本帖最后由 wjcx0113 于 2008-4-6 20:41 编辑 [/i]]
2008-4-6 21:04
haohappy
[url]http://framework.zend.com/manual/zh/zend.controller.modular.html[/url]
2008-4-6 21:06
wjcx0113
谢谢!怎么一直没有找到呢
2008-4-6 21:55
wjcx0113
仔细看了这个教程,还是无法实现
我按照 他说的所谓的 指定模块的最容易的方法 改变了我的目录树,如下:
application/
modules/
default/i
controllers/
models/
views /
news/
controllers/
models/
views /
library/
zend/
Smarty/
public/
.htaccess
index.php
我的index.php是这样的:
<?php
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Asia/shanghai');
set_include_path(dirname(__FILE__)
. '/library' . PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::loadClass('Zend_Controller_Front');
// 获取前端控制器实例
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$front = Zend_Controller_Front::getInstance();
$front->addModuleDirectory('./application/modules');
// run!
$frontController->dispatch();
这样的话输入.com/ 还是能运行,可是输入.com/news 还是提示404错误.
我是新手,不知道原因啊,都是根据教程来的啊,怎么就不行呢?
[[i] 本帖最后由 wjcx0113 于 2008-4-7 18:05 编辑 [/i]]
2008-4-11 13:23
wjcx0113
已经解决了
2008-4-11 16:25
liyong98847
回复 #5 wjcx0113 的帖子
怎么解决的?
页:
[1]
Powered by Discuz! Archiver 5.5.0
© 2001-2006 Comsenz Inc.