无可厚非PHP还是普及度最高,最简单的语言。
想快速开发系统还是用PHP比较好。
初学PHP,那就以现在最火的团购网站源码最土来做分析学习。
最土网站 http://www.zuitu.com/
开发工具
dreamwear
xampp
前台分析
我们首先来看首页index.php的源码
我勒个去,找不到HTML标签。难道HTML用模版实现的?
算了,先从第一句看吧,谁叫我是菜鸟呢。
require_once(dirname(__FILE__) . '/app.php');直接google,过程省略。
http://php.net/manual/zh/function.require-once.php
意思就是只引用一次app.php。 app.php应该是MVC框架的控制器。
我们再看看app.php里写了什么。
马勒隔壁,这么多。看得头晕,还是先把index.php看完再看下面一层吧。不然就是无限循环啊。。。切记,切记。
待解决疑问
/* session,cache,configure,webroot register */ Session::Init(); $INI = ZSystem::GetINI(); /* end */
include/function/common.php
function index_get_team($city_id) { global $INI; $multi = option_yes('indexmulti'); if (!$multi) return current_team($city_id); $city_id = abs(intval($city_id)); $now = time(); $size = abs(intval($INI['system']['sideteam'])); if ($size<=1) return current_team($city_id); $oc = array( 'city_id' => array($city_id, 0), 'team_type' => 'normal', "begin_time < '{$now}'", "end_time > '{$now}'", ); $teams = DB::LimitQuery('team', array( 'condition' => $oc, 'order' => 'ORDER BY `sort_order` DESC, `id` DESC', 'size' => $size, )); if(count($teams) == 1) return array_pop($teams); return $teams; }