質問

Zend Framework 1.11.5をインストールしました。Wamp2.2とWindows7を実行しています。

Apache DocumentRoot( 'c:/wamp/www'); 'mysite'フォルダー構造内にフォルダー(mysite)があります。

/application
   /controllers
        IndexController.php
   /views
      /scripts
        index.phtml
   bootstrap.php
/library
/public
   /css
   /images
   /javascript
   .htaccess
   index.php

問題: ブラウザを「http:// localhost/mysite/public/'」と指した場合、インデックスページを正しく表示できますが、' http:// localhost/mysite/public/index/'または' http:/ /localhost/ejoin2ed/public/index/index 'wampserver構成ページが表示されます(これは、私が持っている別のページ、「index.php」内部の出力であると考えています。

代わりにindex.phtmlのコンテンツを見るべきではありませんか?

ありがとう

ルカ

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

index.php

//identify the location of th application dir in respect to 
//the botstrap file's location, and configure PHP's include_path to
//include the library directory's location

define('APPLICATION_PATH',realpath(dirname(__FILE__).'/../application/'));
set_include_path(APPLICATION_PATH.'/../library'.PATH_SEPARATOR.
get_include_path());

//give the zend framework the ability to load classes on demand,
//as you request them,rather than having to deal with require() statements.

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

//retrieve the BOOTSTRAP file
try
{
require'../application/bootstrap.php';  
}
catch(Exception $exception)
{
printf('Could not locate bootstrap.php');
exit(1);    
}

//start using the front controller in order to route all requests
Zend_Controller_Front::getInstance()->dispatch();

bootstrap.php

//configure the site environment status

defined('APPLICATION_ENVIRONMENT')
or define('APPLICATION_ENVIRONMENT','development');

//invoke the front controller
$frontController=Zend_Controller_Front::getInstance();

//identify the location of the controller directory
$frontController->setControllerDirectory(APPLICATION_PATH.'/controllers');

//create the env parameter so you can later access the environment
//status within the application

$frontController->setParam('env',APPLICATION_ENVIRONMENT);

//clean up all allocated script resources
unset($frontController);
役に立ちましたか?

解決

htaccessファイルに問題があります。

index.phpでのスラッシュが問題です

RewriteRule ^.*$ /index.php [NC,L] 

あるべきです

RewriteRule ^.*$ index.php [NC,L]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top