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

 

 

参考链接: