所有连接请求都经过根目录里的.htaccess处理了url rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [NE,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>
现在所有请求都发送给index.php作为参数
index.php仅加载 ./system/LOADER.php
LOADER.php
$SCRIPT_START_TIME = microtime(TRUE);
//microtime() 函数返回当前 Unix 时间戳和微秒数。
//如果给出了 get_as_float 参数并且其值等价于 TRUE,该函数将返回一个浮点数。
chdir(dirname(__FILE__));
//切换路径到当前文件所属路径: ./system/
require_once('./helpers/func_main.php');
//调用库函数,func_main.php的第一个__autoload方法会自动加载system/class/目录下的所有类
require_once('./conf_system.php');
//调用配置参数,主要是会引用conf_main.php,一个安装后生成的配置文件,有数据库信息
session_start(); //开启php session机制
$cache = new cache(); //创建一个system/classes/class_cache.php类的实例
$db1 = new mysql($C->DB_HOST, $C->DB_USER, $C->DB_PASS, $C->DB_NAME);
$db2 = &$db1;
if( ! $C->INSTALLED ) { //conf_main.php里定义的
exit;
}
$network = new network(); //class_network.php
$network->LOAD();
$user = new user(); //class_user.php
$user->LOAD();
ob_start('ob_gzhandler', 6); //缓存输出,callback调用ob_gzhandler
$page = new page();
$page->LOAD();
conf_main.php
<?php
$C->DOMAIN = 'localhost';
$C->SITE_URL = 'http://localhost/';
// Random identifier for this installation on this server
$C->RNDKEY = '15009';
$C->DB_HOST = 'localhost';
$C->DB_USER = 'root';
$C->DB_PASS = '123456';
$C->DB_NAME = 'db_name';
$C->DB_MYEXT = 'mysqli'; // 'mysqli' or 'mysql'
// CACHE SETTINGS
$C->CACHE_MECHANISM = 'filesystem'; // 'apc' or 'memcached' or 'mysqlheap' or 'filesystem'
$C->CACHE_EXPIRE = 3600;
$C->CACHE_KEYS_PREFIX = '15009';
// If 'memcached':
$C->CACHE_MEMCACHE_HOST = '';
$C->CACHE_MEMCACHE_PORT = '';
// If 'filesystem':
$C->CACHE_FILESYSTEM_PATH = $C->INCPATH.'cache/';
// IMAGE MANIPULATION SETTINGS
$C->IMAGE_MANIPULATION = 'gd'; // 'imagemagick_cli' or 'gd'
// if 'imagemagick_cli' - /path/to/convert
$C->IM_CONVERT = 'convert';
// DEFAULT LANGUAGE
$C->LANGUAGE = 'en';
// USERS ACCOUNTS SETTINGS
// if urls are user.site.com or site.com/user
// this setting is still beta and it is not working properly
$C->USERS_ARE_SUBDOMAINS = FALSE;
// RPC PING SETTINGS
$C->RPC_PINGS_ON = TRUE;
$C->RPC_PINGS_SERVERS = array('http://rpc.pingomatic.com');
// TWITTER & FACEBOOK CONNECT SETTINGS
// To activate Facebook Connect, check out the README.txt file
$C->FACEBOOK_API_KEY = '';
// To activate Twitter OAuth login, check out the README.txt file
$C->TWITTER_CONSUMER_KEY = '';
$C->TWITTER_CONSUMER_SECRET = '';
// Bit.ly Integration - used for sharing posts to twitter
$C->BITLY_LOGIN = 'blogtronixmicro';
$C->BITLY_API_KEY = 'R_ffd756f66a4f5082e37989f1bc3301a6';
// For inviting Yahoo contacts. Check out the README.txt file
$C->YAHOO_CONSUMER_KEY = '';
$C->YAHOO_CONSUMER_SECRET = '';
// FOOTER "Powered by Blogtronix" BACKLINK
// The License requires you to keep this backlink. To remove it, visit this page
// and follow the instructions: http://sharetronix.com/sharetronix/linkremoval
// Otherwise you are not allowed to modify this variable or remove the link.
$C->FOOTER_REMOVE_BACKLINK = FALSE;
// IF YOUR SERVER SUPPORTS CRONJOBS, READ THE FILE ./system/cronjobs/readme.txt
$C->CRONJOB_IS_INSTALLED = FALSE;
// DO NOT REMOVE THIS
$C->INSTALLED = TRUE;
$C->VERSION = '1.5.4';
$C->DEBUG_USERS = array();
?>
还没看到怎么调用控制器的,继续查代码
(page类里的_parse_input()方法貌似是处理url字符,做路由选择控制器的)
(load_template()方法应该是调用视图的 )
预留
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)