新手求問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 onRewriteRule !\.(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