Getting Started with Zend Framework MVC Applications
Getting Started with Zend Framework MVC Applications
This tutorial is intended to give an introduction to using Zend Framework 2 by creating a simple database driven application using the Model-View-Controller paradigm. By the end you will have a working ZF2 application and you can then poke around the code to find out more about how it all works and fits together.
Some assumptions
This tutorial assumes that you are running at least PHP 5.6 with the Apache web server and MySQL, accessible via the PDO extension. Your Apache installation must have the mod_rewrite extension installed and configured.
You must also ensure that Apache is configured to support .htaccess files. This is usually done by changing the setting:
AllowOverride None
to
AllowOverride FileInfo
in your httpd.conf file. Check with your distribution’s documentation for exact details. You will not be able to navigate to any page other than the home page in this tutorial if you have not configured mod_rewrite and .htaccess usage correctly.
Getting started faster
Alternatively, you can use any of the following as well:
- The built-in web server in PHP. Run
php -S 0.0.0.0:8080 -t public/ public/index.phpin your application root to start a web server listening on port 8080.- Use the shipped
Vagrantfile, by executingvagrant upfrom the application root. This binds the host machine's port 8080 to the Apache server instance running on the Vagrant image.- Use the shipped docker-compose integration, by executing
docker-compose up -d --buildfrom the application root. This binds the host machine's port 8080 to the Apache server instance running container.
The tutorial application
The application that we are going to build is a simple inventory system to display which albums we own. The main page will list our collection and allow us to add, edit and delete CDs. We are going to need four pages in our website:
| Page | Description |
|---|---|
| List of albums | This will display the list of albums and provide links to edit and delete them. Also, a link to enable adding new albums will be provided. |
| Add new album | This page will provide a form for adding a new album. |
| Edit album | This page will provide a form for editing an album. |
| Delete album | This page will confirm that we want to delete an album and then delete it. |
We will also need to store our data into a database. We will only need one table with these fields in it:
| Field name | Type | Null? | Notes |
|---|---|---|---|
| id | integer | No | Primary key, auto-increment |
| artist | varchar(100) | No | |
| title | varchar(100) | No |
Getting Started with Zend Framework MVC Applications的更多相关文章
- Zend Framework MVC的结构
The Zend Framework MVC Architecture 一.概述: In this chapter, we will cover the following topics:1. Zen ...
- Zend Framework 留言本实战(转)
一.环境搭建和ZF安装 *[注]本节内容大部分来至Zend Framework官方手册 1.1 Zend Framework下载 Zend Framework 使 ...
- Zend Framework 框架搭建
通过手工方法搭建Zend Framework的MVC框架结构.首先看一下zend framework mvc的目录结构 1. 在根目录下面创建 public ,并在 public 下创建 index. ...
- 【原创】Zend Framework 2框架之MVC
ZendFramework 2框架之MVC 作者:sys(360电商技术组) 1.前言 Zend Framework 2是zend官方推出的php开源框架,基于php5.3.他全然採用面向对象的代码实 ...
- Zend Framework 入门(4)—页面布局
Zend Framework 的页面布局模块——Zend_Layout——既可以跟 MVC 一起使用,也可以单独使用.本文只讨论与 MVC 一起使用的情况. 1. 布局脚本 在 application ...
- Zend Framework
参考:http://www.php100.com/manual/ZendFramework/index.html 1.1. 概述 Zend Framework (ZF) 是一个开放源代码的 PHP5 ...
- Zend Framework学习日记(2)--HelloWorld篇(转)
Zend Framework学习日记(2)--HelloWorld篇 这一篇主要演示如何用zf命令行工具建立一个基于Zend Framework框架的工程,也是我初学Zend Framework的小练 ...
- zend framework 1 安装教程
网上的安装教程总是一笔带过,本人结合已经爬过的坑,为大家展示最简单的安装方式: 博主环境如下: 操作系统:win7 64bit 开发环境:lnmp(phpstudy) 注意: zftest:官方下载的 ...
- Zend Framework 3.0 安装及创建初始化项目教程
前言: 最近开始接触关于PHP的框架的学习,然而PHP的框架少说也有七八种. 百度了一下,有人说ThinkPHP简单暴力的,有人说Laravel高大上的,等等等等,难以抉择. 最终我还是选择先从接触Z ...
随机推荐
- C++实现网格水印之调试笔记(三)—— 初有结果
错误: error C2338: THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD 这种错误 ...
- 跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量
跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量 * This example program demonstrates the basic usage of a fuzz ...
- MSI/MSI-X
MSI PCI2.2规范引进了MSI作为传统的基于线的中断的替代方案.MSI允许设备通过向一个特定的地址写入一个特定的值来允许中断,而不是使用一个专有的引脚来触发中断.注意消息的目的地址和消息数据被当 ...
- mahout协同过滤算法
一直使用mahout的RowSimilarity来计算物品间的相似度,今晚仔细看了其实现,终于搞明白了他的计算逻辑. 上篇中介绍了整个itemBaseCF的mapreducer过程,主要有三个大的步骤 ...
- Spark生态之Spark Graphx
- 【转】iOS 浅谈:深.浅拷贝与copy.strong
深.浅拷贝 copy mutableCopy NSString 1 2 3 4 5 6 NSString *string = @"汉斯哈哈哈"; // 没有产生新对象 NSStri ...
- POJ 1860 Currency Exchange (bellman-ford判负环)
Currency Exchange 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/E Description Several c ...
- CodeForces 489C Given Length and Sum of Digits... (贪心)
Given Length and Sum of Digits... 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/F Descr ...
- BestCoder Round #65 hdu5590(水题)
ZYB's Biology Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- HDU 1078 FatMouse and Cheese (记忆化搜索)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078 老鼠初始时在n*n的矩阵的(0 , 0)位置,每次可以向垂直或水平的一个方向移动1到k格,每次移 ...