0

まず第一に、私は初心者です。wampサーバーにzendフレームワークを正常にインストールしました。私のインクルードパスは次のとおりです。

include_path ="。;E:\ wamp \ bin \ php \ zend_framework \ library"

プロジェクト名「mehedi」を作成しました。しかし、mehedi / application /ディレクトリにあるBootstrap.phpファイルを参照すると、次のエラーが表示されます。

Fatal error: Class 'Zend_Application_Bootstrap_Bootstrap' not found in E:\wamp`\www\mehedi\application\Bootstrap.php on line 4`

mehedi / public / index.php以外の他のphpファイルを参照すると、致命的なエラーが表示されます。

すべてが大丈夫ですか、それとも私は何か重要なことを見逃しました。

mehedi / application / configs/application.iniファイルのアプリケーション構成は次のとおりです。

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
4

1 に答える 1

1

Zend_Tool コマンド ライン インターフェイスを使用してアプリケーションをセットアップし、.htaccessファイルを既定の public フォルダーに配置した場合。
あなたが説明したこの動作は予想されるものです。ZF MVC は、index.php ファイルを介してすべての要求をルーティングします (画像、css、javascript などのリソースを除く)。したがって、ファイルに直接ルーティングできる場合はBootstrap.php心配です。

ZF のすべての URL は、www.example.com/moduleName/controllerName/actionName必要に応じてパラメータを追加できる形式にする必要があります。また、 はオプションであり、一致するルートがない場合moduleNameはデフォルトで になることに注意してください。controllerNamemoduleName

インストールをテストするには、次のような URL を使用しmehedi/public/index/ます。デフォルトのウェルカム画面が表示されます。コントローラーとアクションを追加すると、新しい URL ルートが自動的に追加されます。

[編集] たとえば、というコントローラーを追加するとAdminController(Zend_Tool で追加すると、自動的に indexAction() でビルドされます)。AdminController/indexActionの URL を使用してに自動的にルーティングできるようになり、機能しwww.mehedi.com/admin/indexます。(ほとんどのアプリケーションでは index がデフォルト アクションとして指定されているwww.mehedi.com/adminため、同じ結果が得られます)

PSあなた自身に好意を持ち、仮想ホストをセットアップすると、人生がとても楽になります

これは仮想ホストがどのように見えるかの例です。使用する場合は、localhost を最初の仮想ホストとして宣言することが重要です。

httpd-vhosts.conf  with Include conf/extra/httpd-vhosts.conf enabled in httpd.conf
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    DocumentRoot "C:\Zend\Apache2/htdocs" #I use Zend server, make this match your wamp setup
    ServerName localhost
#directory settings for localhost are typically defined in httpd.conf
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "E:/wamp/www/mehedi/public"
    ServerName www.mehedi.com
    ErrorLog "path/to/your/log/file"
  <directory "E:/wamp/www/mehedi">
      Options Indexes FollowSymlinks
      AllowOverride all
      Order Deny,Allow
      Deny from all
      Allow from 127.0.0.1
  </directory>
</VirtualHost>

この種の vhost セットアップは、ローカルの開発マシンまたは内部ネットワーク サーバーで使用することを意図していることを覚えておくことが重要です。実際に何をしているのかを本当に理解していない限り、運用サーバーでこれを実行したくないでしょう。

于 2012-05-04T13:58:00.883 に答える