新手求問zend freamwork解決方案

來源:互聯網
上載者:User
新手求問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
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.