How to use the model of Zend Framework Model
This article mainly shows you "the model of Zend Framework Model how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use the model of Zend Framework Model" this article.
The details are as follows:
A simple and vulgar example is attached. Just a general description of the usage: if you want to dig deeper, you can follow the source code to understand.
Model_demo1
│ .project
│ .buildpath
│ .zfproject.xml
│
├─ .settings
│ org.eclipse.php.core.prefs
│ .jsdtscope
│ org.eclipse.wst.jsdt.ui.superType.name
│ org.eclipse.wst.jsdt.ui.superType.container
│
├─ application
│ │ Bootstrap.php
│ │
│ ├─ configs
│ │ application.ini
│ │
│ ├─ controllers
│ │ IndexController.php
│ │ ErrorController.php
│ │
│ ├─ models
│ │ Test.php
│ │ ModelTest.php
│ │
│ └─ views
│ ├─ scripts
│ │ ├─ index
│ index.phtml
│ │ │
│ │ └─ error
│ │ error.phtml
│ │
│ └─ helpers
├─ docs
│ README.txt
│
├─ library
│ ├─ app
│ │ Test.php
│ │
│ ├─ myApp
│ │ Test.php
│ │
│ ├─ Zend
│ │ Test.php
│ │
│ ├─ AppTest
│ │ Test.php
│ │
│ └─ AppTest2
│ Test.php
│
├─ public
│ index.php
│ .htaccess
│
└─ tests
│ phpunit.xml
│ bootstrap.php
│
├─ application
│ └─ controllers
│ IndexControllerTest.php
│
└─ library
The following is the source code of each file from top to bottom, which will not be described in detail:
/ model_demo1/application/configs/application.ini
[production] phpSettings.display_startup_errors = 1phpSettings.display_errors = 1includePaths.library = APPLICATION_PATH "/.. / library" bootstrap.path = APPLICATION_PATH "/ Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" autoloadernamespaces.app = "App_" autoloadernamespaces.my = "MyApp_" resources.frontController.controllerDirectory = APPLICATION_PATH "/ controllers" resources.frontController.params.displayExceptions = 1 [staging: production] [testing: production] phpSettings.display_startup_errors = 1phpSettings.display_errors = 1 [ Development: production] phpSettings.display_startup_errors = 1phpSettings.display_errors = 1resources.frontController.params.displayExceptions = 1
/ model_demo1/application/controllers/IndexController.php