1

問題:空白のページが表示される

私がしたいのは、私がタイプするときだけです

http://localhost --> modules/default/index に移動

http://localhost/admin --> modules/admin/index に移動します

index.php は重要ではありません。共通設定

フォルダ構造

ここに画像の説明を入力

Bootstrap.php

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initRoutes()
    {
        $front  = $this->getResource('frontcontroller');
        $router = $front->getRouter();
        $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/routes.xml');
        $router->addConfig($config->routes);

    }
}

アプリケーション.ini

[production]

;Debug output
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0

;Include path
includePaths.library = APPLICATION_PATH "/../library"

;Bootstrap
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

;NameSpace
appnamespace = "Application"

;Front Controller
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

;Modular suport
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =

;resources.frontController.params.prefixDefaultModule = "1"
;resources.frontController.defaultModule = "default"

;Views
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
;resources.view.doctype = "XHTML1_STRICT" 
resources.view.doctype = "XHTML1_TRANSITIONAL"

構成.xml

<?xml version="1.0" encoding="UTF-8"?>
<router>
    <routes>
        <some-action>
            <type>Zend_Controller_Router_Route</type>
            <route>:module/:controller</route>
            <defaults>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </some-action>
    </routes>
</router>

デフォルトのコントローラー

<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }


}

管理コントローラ

<?php

class Admin_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }


}

.htaccess

SetEnv APPLICATION_ENV development

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

エラー:

致命的なエラー: C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Loader\Autoloader.php の 380 行目で最大実行時間が 30 秒を超えました

4

2 に答える 2

0

この場合、ルーター構成は必要ないと思いますか? これは、Zend Framework の標準的な動作です。

現時点ではわかりませんが、IndexController のプレフィックスに「Default_」を付けてみてください。

class Default_IndexController extends Zend_Controller_Action
{

}

これが機能しない場合は、書き換えルールを投稿してください。

于 2011-09-06T06:02:19.863 に答える
0

ルートに次の xml を使用して試してください。

<?xml version="1.0" encoding="UTF-8"?>
<router>
    <routes>
        <front>
            <route>/</route>
            <defaults>
                <module>default</module>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </front>
        <admin>
            <route>/admin</route>
            <defaults>
                <module>admin</module>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </admin>
    </routes>
</router>
于 2011-11-24T11:09:55.467 に答える