日期:2014-05-17 浏览次数:20614 次
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