重构WEB_PHP
1 Abstract
本文主要论述了如何建设web开发中的体系结构。并且使用PHP程序设计语言来阐述构建WEB开发体系结构的实例。
2 前言
web是internet应用的一种方式,从它在1990年出现以来,发展一直很快。从最初的仅仅是文档浏览/查询到现在的基于web方式的应用技术,web技术和应用水平每年都在快速更新和提高。
我们可以使用各种各样的语言来开发web应用。我们将要使用的开发语言是PHP,PHP在1995年开发出第一个版本,到2001年7月根据E-SOFT的统计已经有600万个站点在使用PHP。
参考:
http://www.securityspace.com/s_survey/data/
http://www.w3.org
http://www.php.net
3 问题
WEB的主要功能是传输用户需要的数据资料,开发WEB动态网页也就是开发用户获得需要的数据的过程。
有许多程序员开发各种各样的WEB应用系统仅仅是CASE BY CASE的去做,每次完成一个项目之后又需要做另一个功能相似的项目,而在每次完成之后软件的可重用性和成熟性没有合适的方式得到保证。
仅仅是依靠程序员自身的开发经验来控制代码质量或者使用只有自己才能重用的代码是不能适应大规模的软件生产的。
让我们开发一个可以大家共享的库和结构来开发WEB应用吧。
4 目标
¨ 对数据库等低层操作对象容易封装
¨ 对开发代码容易进行版本管理和分发
¨ 对常用应用系统开发通用应用模块
¨ 对用户定制系统容易采用低层对象构建
¨ 应用容易通过开放接口集成
5 方案
我们可以容易找到一些现成的方案:
¨ microsoft的 .net
¨ sun的j2ee系列
但世界上没有免费的晚餐。
如果使用.net的东西,那末我的设计就绑定在一个专有平台上,然后我开发的东西还要对这个容易崩溃的系统、不喜欢兼容其他系统的厂商交取高额费用。
如果使用j2ee,我也不喜欢一些很笨重缓慢的体系结构。并且这个方案也不能完全满足我的要求。
所幸,我们还有其他的选择:opensource世界的伟大工作:
我们将采用PHP和其他的一些东西来构建我们的应用系统,我们将容易了解低层的细节问题,我们将有一个友好、轻灵、功能齐全并且稳定的系统来完成我们的工作,我们将容易得到其他系统类似的系统设计和开发经验,我们还可以不用担心版权问题。;)
参考:
http://www.microsoft.com/china/net/?MSCOMTB=ICP_Microsoft%20.NET
http://java.sun.com/j2ee/
http://www.valinux.com/
6 采用PHP提供的模型
下面是internet小组在系统结构模型上的示意图:
图一 PHP的WEB开发模型
这幅图中其他部分我都不谈了,只描述我们需要做的web结构上的工作
6.1 类封装层
这一层我们将完成整个站点的底层数据构建:
我们参照phplib(http://phplib.netuse.de )和siteManager(http://www.roadsend.com )的结构来实现对异种数据库的封装和站点开发过程中必须的类:
图二 类封装层结构(引用siteManager的资料)
这里面包括了下面的类:
¨站点配置
¨基本模块----数据库访问 等
¨对话管理
¨界面模版管理
¨输入类型实体-选择/文本等
¨输入实体过滤器---email过滤器/数字过滤器
¨debug
通过这样的结构我们可以完成class layer的功能,提供整对web开发的最底层类。
6.2 应用总线
应用总线是从某种意义上来讲是个概念层的东西。它提供一个接口来连接应用,让各种通过class layer编写的应用模块容易结合在一起。
我们先了解一下总线的意义,拿硬件的总线做个比喻:
网卡、声卡、显卡这三个不同用途的硬件可以通过PCI总线连接到一起,并且通过CPU协同统一协调的工作,您不会因为这些硬件是由不同厂商提供的而无法正常工作。因为PCI总线是工业标准的通讯方式,这些硬件都使用同一种"语言"来交流。
图三 一个硬件总线结构的样例
我们的任务要完成的就是这样一个"WEB软件应用模块总线"结构:
这似乎很难,所幸的是,phpgroupware和webmin都可以作为一个好的例子:
图四 web应用总线示意图
通过统一的接口协议,我们可以容易集成应用到统一的整体,并拥有一个应用开发平台。
具体的内容在这里就不再多谈了。
参考:
http://www.phpgroupware.org
http://www.webmin.com
7 结论
我们通过上面的系统结构设计,并在许多网站和内部web应用系统上的具体应用,可以逐渐形成自己的成熟、稳定的系统结构体系。
并且在系统开发过程中可以有效的利用工具来自动生成web开发的默认模块配置,加快web应用开发和产品化进程。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

Deleted something important from your home screen and trying to get it back? You can put app icons back on the screen in a variety of ways. We have discussed all the methods you can follow and put the app icon back on the home screen. How to Undo Remove from Home Screen in iPhone As we mentioned before, there are several ways to restore this change on iPhone. Method 1 – Replace App Icon in App Library You can place an app icon on your home screen directly from the App Library. Step 1 – Swipe sideways to find all apps in the app library. Step 2 – Find the app icon you deleted earlier. Step 3 – Simply drag the app icon from the main library to the correct location on the home screen. This is the application diagram

The role and practical application of arrow symbols in PHP In PHP, the arrow symbol (->) is usually used to access the properties and methods of objects. Objects are one of the basic concepts of object-oriented programming (OOP) in PHP. In actual development, arrow symbols play an important role in operating objects. This article will introduce the role and practical application of arrow symbols, and provide specific code examples to help readers better understand. 1. The role of the arrow symbol to access the properties of an object. The arrow symbol can be used to access the properties of an object. When we instantiate a pair

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head
