Rumah  >  Artikel  >  pembangunan bahagian belakang  >  新手求问zend freamwork解决方法

新手求问zend freamwork解决方法

WBOY
WBOYasal
2016-06-13 13:49:24957semak imbas

新手求问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
<br><font color="#e78608">------解决方案--------------------</font><br>zF是这样的访问方式,先把所有的请求利用REWRITE转到统一入口里面去,再经过一系列的处理,便会去执行相对应xxxxxController.php下面的xxxxaction方法的,至于rewrite很容易<br>RewriteEngine on<br>RewriteBase /<br>RewriteCond %{SCRIPT_FILENAME} !-f<br>RewriteCond %{SCRIPT_FILENAME} !-d<br>RewriteRule ^(.*)$ index.php<br>注意到你这种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方法的
<br><font color="#e78608">------解决方案--------------------</font><br>zf  配置出错:<br><br><br>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<br><br><br>在standard.php在242行:<br>require_once 'Zend/Loader.php';<br><br>/** Zend_Controller_Dispatcher_Abstract */<br>require_once 'Zend/Controller/Dispatcher/Abstract.php';<br><br>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<br><br>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<br> <div class="clear">
                 
              
              
        
            </div>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn