CI 框架源码 入口文件 index.php 即程序开始执行的地方
index.php在CI的解压目录下的,和system文件夹并列<?php//定义ENVIRONMENT,system_path,application_folder//根据system_path,application_folder,定义常量BASEPATH,APPPATH,SELF,EXT,FCPATH,SYSDIR*---------------------------------------------------------------*APPLICATIONENVIRONMENT*---------------------------------------------------------------**Youcanloaddifferentconfigurationsdependingonyour*currentenvironment.Settingtheenvironmentalsoinfluences*thingslikelogginganderrorreporting.**Thiscanbesettoanything,butdefaultusageis:**development*testing*production**NOTE:Ifyouchangethese,alsochangetheerror_reporting()codebelow**///ENVIRONMENT决定是否报错define('ENVIRONMENT','development');/**---------------------------------------------------------------*ERRORREPORTING*---------------------------------------------------------------**Differentenvironmentswillrequiredifferentlevelsoferrorreporting.*Bydefaultdevelopmentwillshowerrorsbuttestingandlivewillhidethem.*/if(defined('ENVIRONMENT')){switch(ENVIRONMENT){case'development'://E_ALL:所有错误都报error_reporting(E_ALL);break;case'testing':case'production':error_reporting(0);break;default:exit('Theapplicationenvironmentisnotsetcorrectly.');}}//system文件夹的名字,谁没事儿改它啊/**---------------------------------------------------------------*SYSTEMFOLDERNAME*---------------------------------------------------------------**Thisvariablemustcontainthenameofyour"system"folder.*Includethepathifthefolderisnotinthesamedirectory*asthisfile.**/$system_path='system';//寻找哪个文件夹里的controller//没有后斜杠!!/**---------------------------------------------------------------*APPLICATIONFOLDERNAME*---------------------------------------------------------------**Ifyouwantthisfrontcontrollertouseadifferent"application"*folderthenthedefaultoneyoucansetitsnamehere.Thefolder*canalsoberenamedorrelocatedanywhereonyourserver.If*youdo,useafullserverpath.Formoreinfopleaseseetheuserguide:*http://codeigniter.com/user_guide/general/managing_apps.html**NOTRAILINGSLASH!**/$application_folder='application/mysjjy';//system/core/router.php/**--------------------------------------------------------------------*DEFAULTCONTROLLER*--------------------------------------------------------------------**Normallyyouwillsetyourdefaultcontrollerintheroutes.phpfile.*Youcan,however,forceacustomroutingbyhard-codinga*specificcontrollerclass/functionhere.Formostapplications,you*WILLNOTsetyourroutinghere,butit'sanoptionforthose*specialinstanceswhereyoumightwanttooverridethestandard*routinginaspecificfrontcontrollerthatsharesacommonCIinstallation.**IMPORTANT:Ifyousettheroutinghere,NOOTHERcontrollerwillbe*callable.Inessence,thispreferencelimitsyourapplicationtoONE*specificcontroller.Leavethefunctionnameblankifyouneed*tocallfunctionsdynamicallyviatheURI.**Un-commentthe$routingarraybelowtousethisfeature**///Thedirectoryname,relativetothe"controllers"folder.Leaveblank//ifyourcontrollerisnotinasub-folderwithinthe"controllers"folder//$routing['directory']='';//Thecontrollerclassfilename.Example:Mycontroller//$routing['controller']='';//Thecontrollerfunctionyouwishtobecalled.//$routing['function']='';/**-------------------------------------------------------------------*CUSTOMCONFIGVALUES*-------------------------------------------------------------------**The$assign_to_configarraybelowwillbepasseddynamicallytothe*configclasswheninitialized.Thisallowsyoutosetcustomconfig*itemsoroverrideanydefaultconfigvaluesfoundintheconfig.phpfile.*Thiscanbehandyasitpermitsyoutoshareoneapplicationbetween*multiplefrontcontrollerfiles,witheachfilecontainingdifferent*configvalues.**Un-commentthe$assign_to_configarraybelowtousethisfeature**///$assign_to_config['name_of_config_item']='valueofconfigitem';//--------------------------------------------------------------------//ENDOFUSERCONFIGURABLESETTINGS.DONOTEDITBELOWTHISLINE//--------------------------------------------------------------------/**---------------------------------------------------------------*Resolvethesystempathforincreasedreliability*---------------------------------------------------------------*///SetthecurrentdirectorycorrectlyforCLIrequestsif(defined('STDIN')){chdir(dirname(__FILE__));}if(realpath($system_path)!==FALSE){$system_path=realpath($system_path).'/';}//确保system的末端带有///ensurethere'satrailingslash$system_path=rtrim($system_path,'/').'/';//如果systempath不是一个dir,报错!//Isthesystempathcorrect?if(!is_dir($system_path)){exit("Yoursystemfolderpathdoesnotappeartobesetcorrectly.Pleaseopenthefollowingfileandcorrectthis:".pathinfo(__FILE__,PATHINFO_BASENAME));}/**-------------------------------------------------------------------*Nowthatweknowthepath,setthemainpathconstants*-------------------------------------------------------------------*///pathinfo路径分解//SELFindex.php//ThenameofTHISfiledefine('SELF',pathinfo(__FILE__,PATHINFO_BASENAME));//扩展名//ThePHPfileextension//thisglobalconstantisdeprecated.define('EXT','.php');//定义BASEPATH为system_path//Pathtothesystemfolderdefine('BASEPATH',str_replace("\\","/",$system_path));//将index.php去掉//Pathtothefrontcontroller(thisfile)define('FCPATH',str_replace(SELF,'',__FILE__));//Nameofthe"systemfolder"define('SYSDIR',trim(strrchr(trim(BASEPATH,'/'),'/'),'/'));//定义APPPATH为$application_folder.'/'//Thepathtothe"application"folder//is_dir($filename)如果filename是一个相对路径,则按照当前工作目录检查其相对路径//即index.php所在目录下没有application_folder,就找system下有没有,定义为APPPATHif(is_dir($application_folder)){define('APPPATH',$application_folder.'/');}else{if(!is_dir(BASEPATH.$application_folder.'/')){exit("Yourapplicationfolderpathdoesnotappeartobesetcorrectly.Pleaseopenthefollowingfileandcorrectthis:".SELF);}define('APPPATH',BASEPATH.$application_folder.'/');}/**--------------------------------------------------------------------*LOADTHEBOOTSTRAPFILE*--------------------------------------------------------------------**Andawaywego...**///引用system/core/CodeIgniter.phprequire_onceBASEPATH.'core/CodeIgniter.php';/*Endoffileindex.php*//*Location:./index.php*/
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。