当前位置:Gxlcms > PHP教程 > 新手求问zendfreamwork解决方法

新手求问zendfreamwork解决方法

时间:2021-07-01 10:21:17 帮助过:18人阅读

新手求问zend freamwork
http://localhost/zfdemo/pubilc/index.php可以访问
zfdemo工程名称
1、
请问怎么用
http://localhost/zfdemo/index.php访问
2、
IndexAction中新添加 helloAction views-scripts-index中添加hello.phtml

请问在首页怎么用超链接跳转到这个页面




------解决方案--------------------
最好要开启 url重写,
然后public 后面跟Controller名称/Action前缀
------解决方案--------------------
学习了!
------解决方案--------------------
1.无论是你把index.php 放到public下还是放到根目录下这都没问题,只要你在.htaccess文件中写明
PHP code

RewriteEngine on
RewriteRule !\.(ico|js|gif|jpg|png|php)$ public/index.php

------解决方案--------------------
zF是这样的访问方式,先把所有的请求利用REWRITE转到统一入口里面去,再经过一系列的处理,便会去执行相对应xxxxxController.php下面的xxxxaction方法的,至于rewrite很容易
RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php
注意到你这种http://127.0.0.1:8083/fristZFdemo/public/index/add,我猜可能是你的WEB目录没有指对,你把http://127.0.0.1:8083指向到"WEB目录/firstZFdemo/public",在PUBLIC目录下放入.htaccess与index.php文件,再利用http://127.0.0.1/index/add去访问,便会去访问indexcontroller.php里面的addaction方法的
------解决方案--------------------
zf 配置出错:


Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index.php)' in D:\wamp\Apache2.2\htdocs\zendframework\library\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 D:\wamp\Apache2.2\htdocs\zendframework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 D:\wamp\Apache2.2\htdocs\zendframework\index.php(29): Zend_Controller_Front->dispatch() #2 {main} thrown in D:\wamp\Apache2.2\htdocs\zendframework\library\Zend\Controller\Dispatcher\Standard.php on line 242


在standard.php在242行:
require_once 'Zend/Loader.php';

/** Zend_Controller_Dispatcher_Abstract */
require_once 'Zend/Controller/Dispatcher/Abstract.php';

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\Apache2.2\htdocs\zendframework\library\Zend\Controller\Dispatcher\Standard.php on line 24

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\php5\pear') in D:\wamp\Apache2.2\htdocs\zendframework\library\Zend\Controller\Dispatcher\Standard.php on line 24

人气教程排行