Newbie asks idea. php to access zfdemo project name 1. how can I use localhostzfdemoindex. php to access 2? add helloActionviews-scripts-index in IndexAction. newbie asks zend freamwork
Http: // localhost/zfdemo/pubilc/index. php can be accessed
Zfdemo project name
1,
How can I use it?
Http: // localhost/zfdemo/index. php access
2,
Add hello. phtml to helloAction views-scripts-index in IndexAction.
How can I use a hyperlink to jump to this page on the homepage?
------ Solution --------------------
It is best to enable url rewriting,
Then the name of the Controller and the prefix of the Action are public.
------ Solution --------------------
Learning!
------ Solution --------------------
1. whether you put index. php in the public directory or in the root directory, this is okay, as long as you specify in the. htaccess file
PHP code
RewriteEngine onRewriteRule! \. (Ico | js | gif | jpg | png | php) $ public/index. php
------ Solution --------------------
ZF is such an access method. first, all requests are transferred to the unified portal using REWRITE. after a series of processing, the corresponding xxxcontroller will be executed. the xxxxaction method in php is easy to rewrite.
RewriteEngine on
RewriteBase/
RewriteCond % {SCRIPT_FILENAME }! -F
RewriteCond % {SCRIPT_FILENAME }! -D
RewriteRule ^ (. *) $ index. php
Note that you have such http: // 127.0.0.1: 8083/fristZFdemo/public/index/add. I guess your WEB directory is not correct: 8083 point to "WEB directory/firstZFdemo/public" and put it in the PUBLIC directory. htaccess and index. use http: // 127.0.0.1/index/add to access the php file to access indexcontroller. the addaction method in php
------ Solution --------------------
Zf configuration error:
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): dispatch-> 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
In standard. php, row 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