mycncart 前台代码跟踪

1.进入根目录的入口文件,index.php

require_once(DIR_SYSTEM . 'startup.php');//最为重要的一步

start('catalog');//执行了这个方法


2.根目录/mycncart/system/startup.php 文件
在这个文件里,定义了需要php版本,php配置和一些server

spl_autoload_register('library');//自动加载函数
加载地址为:$file = DIR_SYSTEM . 'library/' . str_replace('\', '/', strtolower($class)) . '.php';#mycncart/system/library/

引入了enginehe 和helper的一些函数
这个文件中,注意是一些文件加载

3.根目录/mycncart/system/framework.php 文件

registry:注册类和配置类(config)

两个配置文件:system/config
default.php
和前台配置文件默认为catalog.php  他会覆盖default.php 中的配置

$config->get('action_default');可以得到配置文件的值


4.路由
$controller->dispatch(new Action($config->get('action_router')), new Action($config->get('action_error')));


// Route
if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
    $route = $this->request->get['route'];
} else {
    $route = $this->config->get('action_default');
}


原文地址:https://www.cnblogs.com/myvic/p/6344563.html