Home  >  Article  >  Backend Development  >  构架上的疑惑

构架上的疑惑

WBOY
WBOYOriginal
2016-06-13 12:42:14863browse

构架上的困惑

本帖最后由 muyuruhai 于 2013-07-15 10:54:01 编辑 大家好
小弟曾经写过一个网站,用的方式如下

index.php 首页

后台logic 有一个php文件,logic.php

在 logic.php 里面写了
$action=_$POST[action]
switch $action
case check_userlogin
   login(_$POST[username],_$POST[pwd]);
case put_comment
   put_comment(_$POST[Comment]);
...
end switch

通过这样的方式调用不一样的action 执行不同的函数, logic.php就像所有操作的通用入口。

因为最近看了mvc框架,虽然明白原理,但是不深入的话感觉还是有些困难。
如果自己做一个小项目,这样switch的结构合适不合适呢?

前台如果用ajax,一般我就会调用 url:logic.php
                          data:{action:update_commnet,commnet:"hellow"} 类似这种


因为时间比较紧张,如果再现学一个MVC我怕会来不及,请给点建议

谢谢各位


结构
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn