网络编程 
首页 > 网络编程 > 浏览文章

Zend Framework教程之模型Model用法简单实例

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )

本文实例讲述了Zend Framework教程之模型Model用法。分享给大家供大家参考,具体如下:

附一个简单粗俗的例子。只是大概说明了用法:如果要深究,可以自己跟踪源码了解。

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

如下是从上到下,每一个文件的源码,不再详细说明:

/model_demo1/application/configs/application.ini

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.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 = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

/model_demo1/application/controllers/IndexController.php

<"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"htmlcode">
<"_blank" href="https://www.jb51.net/Special/546.htm">Zend FrameWork框架入门教程》、《php优秀开发框架总结》、《Yii框架入门及常用技巧总结》、《ThinkPHP入门教程》、《php面向对象程序设计入门教程》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家PHP程序设计有所帮助。

上一篇:Zend Framework教程之视图组件Zend_View用法详解
下一篇:基于PHP实现等比压缩图片大小
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。