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 ...
随机推荐
- Winxp下搭建SVN服务器
本文介绍一种在winxp下搭建SVN服务器的方法. (1) 需要下载Slik-Subversion和TortoiseSVN两个软件.我使用的版本是Slik-Subversion-1.8.3-1-win ...
- .net mvc HtmlHelper扩展使用
如果是你是从webform开始接触.net,你应该记得webform开发中,存在自定义控件这东西,它使得我们开发起来十分方便,如今mvc大势所趋,其实在mvc开发时,也存在自定义控件这么个东西,那就是 ...
- SpannableString 记录(转)
引用 http://blog.csdn.net/rockcoding/article/details/7231756 TextView是用来显示文本的,有时需要给TextView中的个别字设置为超链接 ...
- POJ动态规划题目列表
列表一:经典题目题号:容易: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1191,1208, 1276, 13 ...
- jackson 注解的使用
在实体对象上添加 @JsonAutoDetect , 表明对该实体对象序列化成json串. @JsonAutoDetect public class User{ private int id; pri ...
- 内存映射文件详解-----C++实现
先不说内存映射文件是什么.贴个代码先,. #include <iostream> #include <fcntl.h> #include <io.h> #inclu ...
- POJ 2763 Housewife Wind (树链剖分 有修改单边权)
题目链接:http://poj.org/problem?id=2763 n个节点的树上知道了每条边权,然后有两种操作:0操作是输出 当前节点到 x节点的最短距离,并移动到 x 节点位置:1操作是第i条 ...
- swfupload用法总结
<script src="${base}/thirdparty/swfupload/swfupload.js" type="text/javascript" ...
- 【Todo】ipcs命令学习
可以先看这一篇 http://www.jb51.net/article/40805.htm
- 从gitbook将书籍导入到github中
gitbook自己的导出工具经常出问题,可直接使用git. 从gitbook中clone下书 $ git clone https://git.gitbook.com/username/name_of_ ...