先点击http://www.yiichina.com/download/,下载一份yii源代码。
下载完毕,将文件解压缩到工程目录yii下。
打开/yii/demos/blog/index.php。下面就开始我们的源代码阅读之旅。index.php代码如下:
<?php // change the following paths if necessary $yii=dirname(__FILE__).'/../../framework/yii.php'; $config=dirname(__FILE__).'/protected/config/main.php'; // remove the following line when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); require_once($yii); Yii::createWebApplication($config)->run();
1.
魔术常量(__FILE__)
php里面的魔术常量有7个,分别是:
__LINE__当前文件行号
__FILE__文件的完整路径和文件名
__DIR__文件所在目录
__FUNCTION__所在的函数名称
__CLASS__所在类的名称
__METHOD__类的方法名称
__NAMESPACE__空间名称 v5.3.0新增
2.函数dirname
该函数属于文件系统相关扩展(FileSystem 函数)
作用:返回文件路径中的目录部分。
分析完了,再看源代码
$yii="D:\project\yii\framework\yii.php"
$config="D:\project\yii\demos\blog\protect/config/main.php"
设置调试变量
调用defined判断常量YII_DEBUG是否存在,不存在,设置其为true。
require_once 导入$yii
yii.php代码如下:
<?php /** * Yii bootstrap file. * * @author Qiang Xue <qiang.xue@gmail.com> * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ * @package system * @since 1.0 */ require(dirname(__FILE__).'/YiiBase.php'); /** * Yii is a helper class serving common framework functionalities. * * It encapsulates {@link YiiBase} which provides the actual implementation. * By writing your own Yii class, you can customize some functionalities of YiiBase. * * @author Qiang Xue <qiang.xue@gmail.com> * @package system * @since 1.0 */ class Yii extends YiiBase { }
bootstrap引导文件。
该文件非常简单,除去注释,只有2,3行代码
第一行,引入YiiBase.php
第二行,声明类Yii,继承YiiBase.
由于导入了YiiBase.php。代码如下:
<?php /** * YiiBase class file. * * @author Qiang Xue <qiang.xue@gmail.com> * @link http://www.yiiframework.com/ * @copyright Copyright © 2008-2011 Yii Software LLC * @license http://www.yiiframework.com/license/ * @package system * @since 1.0 */ /** * Gets the application start timestamp. */ defined('YII_BEGIN_TIME') or define('YII_BEGIN_TIME',microtime(true)); /** * This constant defines whether the application should be in debug mode or not. Defaults to false. */ defined('YII_DEBUG') or define('YII_DEBUG',false); /** * This constant defines how much call stack information (file name and line number) should be logged by Yii::trace(). * Defaults to 0, meaning no backtrace information. If it is greater than 0, * at most that number of call stacks will be logged. Note, only user application call stacks are considered. */ defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',0); /** * This constant defines whether exception handling should be enabled. Defaults to true. */ defined('YII_ENABLE_EXCEPTION_HANDLER') or define('YII_ENABLE_EXCEPTION_HANDLER',true); /** * This constant defines whether error handling should be enabled. Defaults to true. */ defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER',true); /** * Defines the Yii framework installation path. */ defined('YII_PATH') or define('YII_PATH',dirname(__FILE__)); /** * Defines the Zii library installation path. */ defined('YII_ZII_PATH') or define('YII_ZII_PATH',YII_PATH.DIRECTORY_SEPARATOR.'zii'); /** * YiiBase is a helper class serving common framework functionalities. * * Do not use YiiBase directly. Instead, use its child class {@link Yii} where * you can customize methods of YiiBase. * * @author Qiang Xue <qiang.xue@gmail.com> * @package system * @since 1.0 */ class YiiBase { /** * @var array class map used by the Yii autoloading mechanism. * The array keys are the class names and the array values are the corresponding class file paths. * @since 1.1.5 */ public static $classMap=array(); /** * @var boolean whether to rely on PHP include path to autoload class files. Defaults to true. * You may set this to be false if your hosting environment doesn't allow changing the PHP * include path, or if you want to append additional autoloaders to the default Yii autoloader. * @since 1.1.8 */ public static $enableIncludePath=true; private static $_aliases=array('system'=>YII_PATH,'zii'=>YII_ZII_PATH); // alias => path private static $_imports=array(); // alias => class name or directory private static $_includePaths; // list of include paths private static $_app; private static $_logger; /** * @return string the version of Yii framework */ public static function getVersion() { return '1.1.13'; } /** * Creates a Web application instance. * @param mixed $config application configuration. * If a string, it is treated as the path of the file that contains the configuration; * If an array, it is the actual configuration information. * Please make sure you specify the {@link CApplication::basePath basePath} property in the configuration, * which should point to the directory containing all application logic, template and data. * If not, the directory will be defaulted to 'protected'. * @return CWebApplication */ public static function createWebApplication($config=null) { return self::createApplication('CWebApplication',$config); } /** * Creates a console application instance. * @param mixed $config application configuration. * If a string, it is treated as the path of the file that contains the configuration; * If an array, it is the actual configuration information. * Please make sure you specify the {@link CApplication::basePath basePath} property in the configuration, * which should point to the directory containing all application logic, template and data. * If not, the directory will be defaulted to 'protected'. * @return CConsoleApplication */ public static function createConsoleApplication($config=null) { return self::createApplication('CConsoleApplication',$config); } /** * Creates an application of the specified class. * @param string $class the application class name * @param mixed $config application configuration. This parameter will be passed as the parameter * to the constructor of the application class. * @return mixed the application instance */ public static function createApplication($class,$config=null) { return new $class($config); } /** * Returns the application singleton or null if the singleton has not been created yet. * @return CApplication the application singleton, null if the singleton has not been created yet. */ public static function app() { return self::$_app; } /** * Stores the application instance in the class static member. * This method helps implement a singleton pattern for CApplication. * Repeated invocation of this method or the CApplication constructor * will cause the throw of an exception. * To retrieve the application instance, use {@link app()}. * @param CApplication $app the application instance. If this is null, the existing * application singleton will be removed. * @throws CException if multiple application instances are registered. */ public static function setApplication($app) { if(self::$_app===null || $app===null){ self::$_app=$app; } else{ throw new CException(Yii::t('yii','Yii application can only be created once.')); } } /** * @return string the path of the framework */ public static function getFrameworkPath() { return YII_PATH; } /** * Creates an object and initializes it based on the given configuration. * * The specified configuration can be either a string or an array. * If the former, the string is treated as the object type which can * be either the class name or {@link YiiBase::getPathOfAlias class path alias}. * If the latter, the 'class' element is treated as the object type, * and the rest of the name-value pairs in the array are used to initialize * the corresponding object properties. * * Any additional parameters passed to this method will be * passed to the constructor of the object being created. * * @param mixed $config the configuration. It can be either a string or an array. * @return mixed the created object * @throws CException if the configuration does not have a 'class' element. */ public static function createComponent($config) { if(is_string($config)) { $type=$config; $config=array(); } elseif(isset($config['class'])) { $type=$config['class']; unset($config['class']); } else throw new CException(Yii::t('yii','Object configuration must be an array containing a "class" element.')); if(!class_exists($type,false)) $type=Yii::import($type,true); if(($n=func_num_args())>1) { $args=func_get_args(); if($n===2) $object=new $type($args[1]); elseif($n===3) $object=new $type($args[1],$args[2]); elseif($n===4) $object=new $type($args[1],$args[2],$args[3]); else { unset($args[0]); $class=new ReflectionClass($type); // Note: ReflectionClass::newInstanceArgs() is available for PHP 5.1.3+ // $object=$class->newInstanceArgs($args); $object=call_user_func_array(array($class,'newInstance'),$args); } } else $object=new $type; foreach($config as $key=>$value) $object->$key=$value; return $object; } /** * Imports a class or a directory. * * Importing a class is like including the corresponding class file. * The main difference is that importing a class is much lighter because it only * includes the class file when the class is referenced the first time. * * Importing a directory is equivalent to adding a directory into the PHP include path. * If multiple directories are imported, the directories imported later will take * precedence in class file searching (i.e., they are added to the front of the PHP include path). * * Path aliases are used to import a class or directory. For example, * <ul> * <li><code>application.components.GoogleMap</code>: import the <code>GoogleMap</code> class.</li> * <li><code>application.components.*</code>: import the <code>components</code> directory.</li> * </ul> * * The same path alias can be imported multiple times, but only the first time is effective. * Importing a directory does not import any of its subdirectories. * * Starting from version 1.1.5, this method can also be used to import a class in namespace format * (available for PHP 5.3 or above only). It is similar to importing a class in path alias format, * except that the dot separator is replaced by the backslash separator. For example, importing * <code>application\components\GoogleMap</code> is similar to importing <code>application.components.GoogleMap</code>. * The difference is that the former class is using qualified name, while the latter unqualified. * * Note, importing a class in namespace format requires that the namespace corresponds to * a valid path alias once backslash characters are replaced with dot characters. * For example, the namespace <code>application\components</code> must correspond to a valid * path alias <code>application.components</code>. * * @param string $alias path alias to be imported * @param boolean $forceInclude whether to include the class file immediately. If false, the class file * will be included only when the class is being used. This parameter is used only when * the path alias refers to a class. * @return string the class name or the directory that this alias refers to * @throws CException if the alias is invalid */ public static function import($alias,$forceInclude=false) { if(isset(self::$_imports[$alias])) // previously imported return self::$_imports[$alias]; if(class_exists($alias,false) || interface_exists($alias,false)) return self::$_imports[$alias]=$alias; if(($pos=strrpos($alias,'\\'))!==false) // a class name in PHP 5.3 namespace format { $namespace=str_replace('\\','.',ltrim(substr($alias,0,$pos),'\\')); if(($path=self::getPathOfAlias($namespace))!==false) { $classFile=$path.DIRECTORY_SEPARATOR.substr($alias,$pos+1).'.php'; if($forceInclude) { if(is_file($classFile)) require($classFile); else throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file and the file is readable.',array('{alias}'=>$alias))); self::$_imports[$alias]=$alias; } else self::$classMap[$alias]=$classFile; return $alias; } else throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing directory.', array('{alias}'=>$namespace))); } if(($pos=strrpos($alias,'.'))===false) // a simple class name { if($forceInclude && self::autoload($alias)) self::$_imports[$alias]=$alias; return $alias; } $className=(string)substr($alias,$pos+1); $isClass=$className!=='*'; if($isClass && (class_exists($className,false) || interface_exists($className,false))) return self::$_imports[$alias]=$className; if(($path=self::getPathOfAlias($alias))!==false) { if($isClass) { if($forceInclude) { if(is_file($path.'.php')) require($path.'.php'); else throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file and the file is readable.',array('{alias}'=>$alias))); self::$_imports[$alias]=$className; } else self::$classMap[$className]=$path.'.php'; return $className; } else // a directory { if(self::$_includePaths===null) { self::$_includePaths=array_unique(explode(PATH_SEPARATOR,get_include_path())); if(($pos=array_search('.',self::$_includePaths,true))!==false) unset(self::$_includePaths[$pos]); } array_unshift(self::$_includePaths,$path); if(self::$enableIncludePath && set_include_path('.'.PATH_SEPARATOR.implode(PATH_SEPARATOR,self::$_includePaths))===false) self::$enableIncludePath=false; return self::$_imports[$alias]=$path; } } else throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing directory or file.', array('{alias}'=>$alias))); } /** * Translates an alias into a file path. * Note, this method does not ensure the existence of the resulting file path. * It only checks if the root alias is valid or not. * @param string $alias alias (e.g. system.web.CController) * @return mixed file path corresponding to the alias, false if the alias is invalid. */ public static function getPathOfAlias($alias) { if(isset(self::$_aliases[$alias])) return self::$_aliases[$alias]; elseif(($pos=strpos($alias,'.'))!==false) { $rootAlias=substr($alias,0,$pos); if(isset(self::$_aliases[$rootAlias])) return self::$_aliases[$alias]=rtrim(self::$_aliases[$rootAlias].DIRECTORY_SEPARATOR.str_replace('.',DIRECTORY_SEPARATOR,substr($alias,$pos+1)),'*'.DIRECTORY_SEPARATOR); elseif(self::$_app instanceof CWebApplication) { if(self::$_app->findModule($rootAlias)!==null) return self::getPathOfAlias($alias); } } return false; } /** * Create a path alias. * Note, this method neither checks the existence of the path nor normalizes the path. * @param string $alias alias to the path * @param string $path the path corresponding to the alias. If this is null, the corresponding * path alias will be removed. */ public static function setPathOfAlias($alias,$path) { if(empty($path)){ unset(self::$_aliases[$alias]); } else{ self::$_aliases[$alias]=rtrim($path,'\\/'); } } /** * Class autoload loader. * This method is provided to be invoked within an __autoload() magic method. * @param string $className class name * @return boolean whether the class has been loaded successfully */ public static function autoload($className) { // use include so that the error PHP file may appear if(isset(self::$classMap[$className])){ include(self::$classMap[$className]); } elseif(isset(self::$_coreClasses[$className])){ include(YII_PATH.self::$_coreClasses[$className]); } else { // include class file relying on include_path if(strpos($className,'\\')===false) // class without namespace { if(self::$enableIncludePath===false) { foreach(self::$_includePaths as $path) { $classFile=$path.DIRECTORY_SEPARATOR.$className.'.php'; if(is_file($classFile)) { include($classFile); if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php') throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array( '{class}'=>$className, '{file}'=>$classFile, ))); break; } } } else include($className.'.php'); } else // class name with namespace in PHP 5.3 { $namespace=str_replace('\\','.',ltrim($className,'\\')); if(($path=self::getPathOfAlias($namespace))!==false) include($path.'.php'); else return false; } return class_exists($className,false) || interface_exists($className,false); } return true; } /** * Writes a trace message. * This method will only log a message when the application is in debug mode. * @param string $msg message to be logged * @param string $category category of the message * @see log */ public static function trace($msg,$category='application') { if(YII_DEBUG) self::log($msg,CLogger::LEVEL_TRACE,$category); } /** * Logs a message. * Messages logged by this method may be retrieved via {@link CLogger::getLogs} * and may be recorded in different media, such as file, email, database, using * {@link CLogRouter}. * @param string $msg message to be logged * @param string $level level of the message (e.g. 'trace', 'warning', 'error'). It is case-insensitive. * @param string $category category of the message (e.g. 'system.web'). It is case-insensitive. */ public static function log($msg,$level=CLogger::LEVEL_INFO,$category='application') { if(self::$_logger===null) self::$_logger=new CLogger; if(YII_DEBUG && YII_TRACE_LEVEL>0 && $level!==CLogger::LEVEL_PROFILE) { $traces=debug_backtrace(); $count=0; foreach($traces as $trace) { if(isset($trace['file'],$trace['line']) && strpos($trace['file'],YII_PATH)!==0) { $msg.="\nin ".$trace['file'].' ('.$trace['line'].')'; if(++$count>=YII_TRACE_LEVEL) break; } } } self::$_logger->log($msg,$level,$category); } /** * Marks the beginning of a code block for profiling. * This has to be matched with a call to {@link endProfile()} with the same token. * The begin- and end- calls must also be properly nested, e.g., * <pre> * Yii::beginProfile('block1'); * Yii::beginProfile('block2'); * Yii::endProfile('block2'); * Yii::endProfile('block1'); * </pre> * The following sequence is not valid: * <pre> * Yii::beginProfile('block1'); * Yii::beginProfile('block2'); * Yii::endProfile('block1'); * Yii::endProfile('block2'); * </pre> * @param string $token token for the code block * @param string $category the category of this log message * @see endProfile */ public static function beginProfile($token,$category='application') { self::log('begin:'.$token,CLogger::LEVEL_PROFILE,$category); } /** * Marks the end of a code block for profiling. * This has to be matched with a previous call to {@link beginProfile()} with the same token. * @param string $token token for the code block * @param string $category the category of this log message * @see beginProfile */ public static function endProfile($token,$category='application') { self::log('end:'.$token,CLogger::LEVEL_PROFILE,$category); } /** * @return CLogger message logger */ public static function getLogger() { if(self::$_logger!==null) return self::$_logger; else return self::$_logger=new CLogger; } /** * Sets the logger object. * @param CLogger $logger the logger object. * @since 1.1.8 */ public static function setLogger($logger) { self::$_logger=$logger; } /** * Returns a string that can be displayed on your Web page showing Powered-by-Yii information * @return string a string that can be displayed on your Web page showing Powered-by-Yii information */ public static function powered() { return Yii::t('yii','Powered by {yii}.', array('{yii}'=>'<a href="http://www.yiiframework.com/" rel="external">Yii Framework</a>')); } /** * Translates a message to the specified language. * This method supports choice format (see {@link CChoiceFormat}), * i.e., the message returned will be chosen from a few candidates according to the given * number value. This feature is mainly used to solve plural format issue in case * a message has different plural forms in some languages. * @param string $category message category. Please use only word letters. Note, category 'yii' is * reserved for Yii framework core code use. See {@link CPhpMessageSource} for * more interpretation about message category. * @param string $message the original message * @param array $params parameters to be applied to the message using <code>strtr</code>. * The first parameter can be a number without key. * And in this case, the method will call {@link CChoiceFormat::format} to choose * an appropriate message translation. * Starting from version 1.1.6 you can pass parameter for {@link CChoiceFormat::format} * or plural forms format without wrapping it with array. * This parameter is then available as <code>{n}</code> in the message translation string. * @param string $source which message source application component to use. * Defaults to null, meaning using 'coreMessages' for messages belonging to * the 'yii' category and using 'messages' for the rest messages. * @param string $language the target language. If null (default), the {@link CApplication::getLanguage application language} will be used. * @return string the translated message * @see CMessageSource */ public static function t($category,$message,$params=array(),$source=null,$language=null) { if(self::$_app!==null) { if($source===null) $source=($category==='yii'||$category==='zii')?'coreMessages':'messages'; if(($source=self::$_app->getComponent($source))!==null) $message=$source->translate($category,$message,$language); } if($params===array()) return $message; if(!is_array($params)) $params=array($params); if(isset($params[0])) // number choice { if(strpos($message,'|')!==false) { if(strpos($message,'#')===false) { $chunks=explode('|',$message); $expressions=self::$_app->getLocale($language)->getPluralRules(); if($n=min(count($chunks),count($expressions))) { for($i=0;$i<$n;$i++) $chunks[$i]=$expressions[$i].'#'.$chunks[$i]; $message=implode('|',$chunks); } } $message=CChoiceFormat::format($message,$params[0]); } if(!isset($params['{n}'])) $params['{n}']=$params[0]; unset($params[0]); } return $params!==array() ? strtr($message,$params) : $message; } /** * Registers a new class autoloader. * The new autoloader will be placed before {@link autoload} and after * any other existing autoloaders. * @param callback $callback a valid PHP callback (function name or array($className,$methodName)). * @param boolean $append whether to append the new autoloader after the default Yii autoloader. */ public static function registerAutoloader($callback, $append=false) { if($append) { self::$enableIncludePath=false; spl_autoload_register($callback); } else { spl_autoload_unregister(array('YiiBase','autoload')); spl_autoload_register($callback); spl_autoload_register(array('YiiBase','autoload')); } } /** * @var array class map for core Yii classes. * NOTE, DO NOT MODIFY THIS ARRAY MANUALLY. IF YOU CHANGE OR ADD SOME CORE CLASSES, * PLEASE RUN 'build autoload' COMMAND TO UPDATE THIS ARRAY. */ private static $_coreClasses=array( 'CApplication' => '/base/CApplication.php', 'CApplicationComponent' => '/base/CApplicationComponent.php', 'CBehavior' => '/base/CBehavior.php', 'CComponent' => '/base/CComponent.php', 'CErrorEvent' => '/base/CErrorEvent.php', 'CErrorHandler' => '/base/CErrorHandler.php', 'CException' => '/base/CException.php', 'CExceptionEvent' => '/base/CExceptionEvent.php', 'CHttpException' => '/base/CHttpException.php', 'CModel' => '/base/CModel.php', 'CModelBehavior' => '/base/CModelBehavior.php', 'CModelEvent' => '/base/CModelEvent.php', 'CModule' => '/base/CModule.php', 'CSecurityManager' => '/base/CSecurityManager.php', 'CStatePersister' => '/base/CStatePersister.php', 'CApcCache' => '/caching/CApcCache.php', 'CCache' => '/caching/CCache.php', 'CDbCache' => '/caching/CDbCache.php', 'CDummyCache' => '/caching/CDummyCache.php', 'CEAcceleratorCache' => '/caching/CEAcceleratorCache.php', 'CFileCache' => '/caching/CFileCache.php', 'CMemCache' => '/caching/CMemCache.php', 'CWinCache' => '/caching/CWinCache.php', 'CXCache' => '/caching/CXCache.php', 'CZendDataCache' => '/caching/CZendDataCache.php', 'CCacheDependency' => '/caching/dependencies/CCacheDependency.php', 'CChainedCacheDependency' => '/caching/dependencies/CChainedCacheDependency.php', 'CDbCacheDependency' => '/caching/dependencies/CDbCacheDependency.php', 'CDirectoryCacheDependency' => '/caching/dependencies/CDirectoryCacheDependency.php', 'CExpressionDependency' => '/caching/dependencies/CExpressionDependency.php', 'CFileCacheDependency' => '/caching/dependencies/CFileCacheDependency.php', 'CGlobalStateCacheDependency' => '/caching/dependencies/CGlobalStateCacheDependency.php', 'CAttributeCollection' => '/collections/CAttributeCollection.php', 'CConfiguration' => '/collections/CConfiguration.php', 'CList' => '/collections/CList.php', 'CListIterator' => '/collections/CListIterator.php', 'CMap' => '/collections/CMap.php', 'CMapIterator' => '/collections/CMapIterator.php', 'CQueue' => '/collections/CQueue.php', 'CQueueIterator' => '/collections/CQueueIterator.php', 'CStack' => '/collections/CStack.php', 'CStackIterator' => '/collections/CStackIterator.php', 'CTypedList' => '/collections/CTypedList.php', 'CTypedMap' => '/collections/CTypedMap.php', 'CConsoleApplication' => '/console/CConsoleApplication.php', 'CConsoleCommand' => '/console/CConsoleCommand.php', 'CConsoleCommandBehavior' => '/console/CConsoleCommandBehavior.php', 'CConsoleCommandEvent' => '/console/CConsoleCommandEvent.php', 'CConsoleCommandRunner' => '/console/CConsoleCommandRunner.php', 'CHelpCommand' => '/console/CHelpCommand.php', 'CDbCommand' => '/db/CDbCommand.php', 'CDbConnection' => '/db/CDbConnection.php', 'CDbDataReader' => '/db/CDbDataReader.php', 'CDbException' => '/db/CDbException.php', 'CDbMigration' => '/db/CDbMigration.php', 'CDbTransaction' => '/db/CDbTransaction.php', 'CActiveFinder' => '/db/ar/CActiveFinder.php', 'CActiveRecord' => '/db/ar/CActiveRecord.php', 'CActiveRecordBehavior' => '/db/ar/CActiveRecordBehavior.php', 'CDbColumnSchema' => '/db/schema/CDbColumnSchema.php', 'CDbCommandBuilder' => '/db/schema/CDbCommandBuilder.php', 'CDbCriteria' => '/db/schema/CDbCriteria.php', 'CDbExpression' => '/db/schema/CDbExpression.php', 'CDbSchema' => '/db/schema/CDbSchema.php', 'CDbTableSchema' => '/db/schema/CDbTableSchema.php', 'CMssqlColumnSchema' => '/db/schema/mssql/CMssqlColumnSchema.php', 'CMssqlCommandBuilder' => '/db/schema/mssql/CMssqlCommandBuilder.php', 'CMssqlPdoAdapter' => '/db/schema/mssql/CMssqlPdoAdapter.php', 'CMssqlSchema' => '/db/schema/mssql/CMssqlSchema.php', 'CMssqlSqlsrvPdoAdapter' => '/db/schema/mssql/CMssqlSqlsrvPdoAdapter.php', 'CMssqlTableSchema' => '/db/schema/mssql/CMssqlTableSchema.php', 'CMysqlColumnSchema' => '/db/schema/mysql/CMysqlColumnSchema.php', 'CMysqlCommandBuilder' => '/db/schema/mysql/CMysqlCommandBuilder.php', 'CMysqlSchema' => '/db/schema/mysql/CMysqlSchema.php', 'CMysqlTableSchema' => '/db/schema/mysql/CMysqlTableSchema.php', 'COciColumnSchema' => '/db/schema/oci/COciColumnSchema.php', 'COciCommandBuilder' => '/db/schema/oci/COciCommandBuilder.php', 'COciSchema' => '/db/schema/oci/COciSchema.php', 'COciTableSchema' => '/db/schema/oci/COciTableSchema.php', 'CPgsqlColumnSchema' => '/db/schema/pgsql/CPgsqlColumnSchema.php', 'CPgsqlSchema' => '/db/schema/pgsql/CPgsqlSchema.php', 'CPgsqlTableSchema' => '/db/schema/pgsql/CPgsqlTableSchema.php', 'CSqliteColumnSchema' => '/db/schema/sqlite/CSqliteColumnSchema.php', 'CSqliteCommandBuilder' => '/db/schema/sqlite/CSqliteCommandBuilder.php', 'CSqliteSchema' => '/db/schema/sqlite/CSqliteSchema.php', 'CChoiceFormat' => '/i18n/CChoiceFormat.php', 'CDateFormatter' => '/i18n/CDateFormatter.php', 'CDbMessageSource' => '/i18n/CDbMessageSource.php', 'CGettextMessageSource' => '/i18n/CGettextMessageSource.php', 'CLocale' => '/i18n/CLocale.php', 'CMessageSource' => '/i18n/CMessageSource.php', 'CNumberFormatter' => '/i18n/CNumberFormatter.php', 'CPhpMessageSource' => '/i18n/CPhpMessageSource.php', 'CGettextFile' => '/i18n/gettext/CGettextFile.php', 'CGettextMoFile' => '/i18n/gettext/CGettextMoFile.php', 'CGettextPoFile' => '/i18n/gettext/CGettextPoFile.php', 'CChainedLogFilter' => '/logging/CChainedLogFilter.php', 'CDbLogRoute' => '/logging/CDbLogRoute.php', 'CEmailLogRoute' => '/logging/CEmailLogRoute.php', 'CFileLogRoute' => '/logging/CFileLogRoute.php', 'CLogFilter' => '/logging/CLogFilter.php', 'CLogRoute' => '/logging/CLogRoute.php', 'CLogRouter' => '/logging/CLogRouter.php', 'CLogger' => '/logging/CLogger.php', 'CProfileLogRoute' => '/logging/CProfileLogRoute.php', 'CWebLogRoute' => '/logging/CWebLogRoute.php', 'CDateTimeParser' => '/utils/CDateTimeParser.php', 'CFileHelper' => '/utils/CFileHelper.php', 'CFormatter' => '/utils/CFormatter.php', 'CMarkdownParser' => '/utils/CMarkdownParser.php', 'CPropertyValue' => '/utils/CPropertyValue.php', 'CTimestamp' => '/utils/CTimestamp.php', 'CVarDumper' => '/utils/CVarDumper.php', 'CBooleanValidator' => '/validators/CBooleanValidator.php', 'CCaptchaValidator' => '/validators/CCaptchaValidator.php', 'CCompareValidator' => '/validators/CCompareValidator.php', 'CDateValidator' => '/validators/CDateValidator.php', 'CDefaultValueValidator' => '/validators/CDefaultValueValidator.php', 'CEmailValidator' => '/validators/CEmailValidator.php', 'CExistValidator' => '/validators/CExistValidator.php', 'CFileValidator' => '/validators/CFileValidator.php', 'CFilterValidator' => '/validators/CFilterValidator.php', 'CInlineValidator' => '/validators/CInlineValidator.php', 'CNumberValidator' => '/validators/CNumberValidator.php', 'CRangeValidator' => '/validators/CRangeValidator.php', 'CRegularExpressionValidator' => '/validators/CRegularExpressionValidator.php', 'CRequiredValidator' => '/validators/CRequiredValidator.php', 'CSafeValidator' => '/validators/CSafeValidator.php', 'CStringValidator' => '/validators/CStringValidator.php', 'CTypeValidator' => '/validators/CTypeValidator.php', 'CUniqueValidator' => '/validators/CUniqueValidator.php', 'CUnsafeValidator' => '/validators/CUnsafeValidator.php', 'CUrlValidator' => '/validators/CUrlValidator.php', 'CValidator' => '/validators/CValidator.php', 'CActiveDataProvider' => '/web/CActiveDataProvider.php', 'CArrayDataProvider' => '/web/CArrayDataProvider.php', 'CAssetManager' => '/web/CAssetManager.php', 'CBaseController' => '/web/CBaseController.php', 'CCacheHttpSession' => '/web/CCacheHttpSession.php', 'CClientScript' => '/web/CClientScript.php', 'CController' => '/web/CController.php', 'CDataProvider' => '/web/CDataProvider.php', 'CDataProviderIterator' => '/web/CDataProviderIterator.php', 'CDbHttpSession' => '/web/CDbHttpSession.php', 'CExtController' => '/web/CExtController.php', 'CFormModel' => '/web/CFormModel.php', 'CHttpCookie' => '/web/CHttpCookie.php', 'CHttpRequest' => '/web/CHttpRequest.php', 'CHttpSession' => '/web/CHttpSession.php', 'CHttpSessionIterator' => '/web/CHttpSessionIterator.php', 'COutputEvent' => '/web/COutputEvent.php', 'CPagination' => '/web/CPagination.php', 'CSort' => '/web/CSort.php', 'CSqlDataProvider' => '/web/CSqlDataProvider.php', 'CTheme' => '/web/CTheme.php', 'CThemeManager' => '/web/CThemeManager.php', 'CUploadedFile' => '/web/CUploadedFile.php', 'CUrlManager' => '/web/CUrlManager.php', 'CWebApplication' => '/web/CWebApplication.php', 'CWebModule' => '/web/CWebModule.php', 'CWidgetFactory' => '/web/CWidgetFactory.php', 'CAction' => '/web/actions/CAction.php', 'CInlineAction' => '/web/actions/CInlineAction.php', 'CViewAction' => '/web/actions/CViewAction.php', 'CAccessControlFilter' => '/web/auth/CAccessControlFilter.php', 'CAuthAssignment' => '/web/auth/CAuthAssignment.php', 'CAuthItem' => '/web/auth/CAuthItem.php', 'CAuthManager' => '/web/auth/CAuthManager.php', 'CBaseUserIdentity' => '/web/auth/CBaseUserIdentity.php', 'CDbAuthManager' => '/web/auth/CDbAuthManager.php', 'CPhpAuthManager' => '/web/auth/CPhpAuthManager.php', 'CUserIdentity' => '/web/auth/CUserIdentity.php', 'CWebUser' => '/web/auth/CWebUser.php', 'CFilter' => '/web/filters/CFilter.php', 'CFilterChain' => '/web/filters/CFilterChain.php', 'CHttpCacheFilter' => '/web/filters/CHttpCacheFilter.php', 'CInlineFilter' => '/web/filters/CInlineFilter.php', 'CForm' => '/web/form/CForm.php', 'CFormButtonElement' => '/web/form/CFormButtonElement.php', 'CFormElement' => '/web/form/CFormElement.php', 'CFormElementCollection' => '/web/form/CFormElementCollection.php', 'CFormInputElement' => '/web/form/CFormInputElement.php', 'CFormStringElement' => '/web/form/CFormStringElement.php', 'CGoogleApi' => '/web/helpers/CGoogleApi.php', 'CHtml' => '/web/helpers/CHtml.php', 'CJSON' => '/web/helpers/CJSON.php', 'CJavaScript' => '/web/helpers/CJavaScript.php', 'CJavaScriptExpression' => '/web/helpers/CJavaScriptExpression.php', 'CPradoViewRenderer' => '/web/renderers/CPradoViewRenderer.php', 'CViewRenderer' => '/web/renderers/CViewRenderer.php', 'CWebService' => '/web/services/CWebService.php', 'CWebServiceAction' => '/web/services/CWebServiceAction.php', 'CWsdlGenerator' => '/web/services/CWsdlGenerator.php', 'CActiveForm' => '/web/widgets/CActiveForm.php', 'CAutoComplete' => '/web/widgets/CAutoComplete.php', 'CClipWidget' => '/web/widgets/CClipWidget.php', 'CContentDecorator' => '/web/widgets/CContentDecorator.php', 'CFilterWidget' => '/web/widgets/CFilterWidget.php', 'CFlexWidget' => '/web/widgets/CFlexWidget.php', 'CHtmlPurifier' => '/web/widgets/CHtmlPurifier.php', 'CInputWidget' => '/web/widgets/CInputWidget.php', 'CMarkdown' => '/web/widgets/CMarkdown.php', 'CMaskedTextField' => '/web/widgets/CMaskedTextField.php', 'CMultiFileUpload' => '/web/widgets/CMultiFileUpload.php', 'COutputCache' => '/web/widgets/COutputCache.php', 'COutputProcessor' => '/web/widgets/COutputProcessor.php', 'CStarRating' => '/web/widgets/CStarRating.php', 'CTabView' => '/web/widgets/CTabView.php', 'CTextHighlighter' => '/web/widgets/CTextHighlighter.php', 'CTreeView' => '/web/widgets/CTreeView.php', 'CWidget' => '/web/widgets/CWidget.php', 'CCaptcha' => '/web/widgets/captcha/CCaptcha.php', 'CCaptchaAction' => '/web/widgets/captcha/CCaptchaAction.php', 'CBasePager' => '/web/widgets/pagers/CBasePager.php', 'CLinkPager' => '/web/widgets/pagers/CLinkPager.php', 'CListPager' => '/web/widgets/pagers/CListPager.php', ); } spl_autoload_register(array('YiiBase','autoload')); require(YII_PATH.'/base/interfaces.php');
相关推荐
本项目源代码是基于Yii框架构建的一个实际应用,对于初学者而言,这是一个很好的学习资源,能够帮助他们深入理解Yii的工作原理和最佳实践。 首先,让我们详细了解一下Yii框架的核心特性。Yii提供了一种模型-视图-...
标题“yii框架源代码”意味着我们将深入探讨Yii框架的核心结构和实现细节。源代码是理解任何软件系统工作原理的关键,对于开发者来说,查看源代码有助于学习框架设计模式,提高编程技能,以及对框架进行定制和扩展。...
这个“用Yii写的商城源代码”很可能是孙海华老师在传智播客的一门课程中的实践项目,旨在帮助学员理解如何利用Yii框架构建一个完整的电子商务平台。在这个项目中,我们可以深入学习到以下几个关键的Yii和商城开发的...
本书不是简单地介绍如何使用 Yii 框架,而是站在框架设计的高度,从源代码级别深 度剖析。本书首先介绍 PHP 框架技术的概念及其应用领域,然后开始仿照 Yii 框架源代码 自定义框架,其中包括了 MVC 设计模式、单入口...
1. MVC设计模式:YII2遵循MVC模式,将业务逻辑、数据处理和用户界面分开,提高代码可读性和可维护性。 2. Composer依赖管理:虽然描述中提到在中国可能需要其他方式,但Composer是PHP的标准依赖管理工具,用于自动...
yii 框架 文件,方便搭建环境,分析代码等等
1. **用户认证与授权**:Yii2提供了强大的身份验证和权限控制机制,如RBAC(角色基础访问控制)。在医疗系统中,这可以确保不同级别的医生、护士和患者只能访问他们被授权的数据。 2. **数据库操作**:Yii2的Active...
系统基于yii2高级版本开发,后台模板使用的 Ace Admin。对于一般的后台开发,比较方便; 对于数据表的CURL操作都有封装,且所有操作都有权限控制。现在这个项目只是一个示例项目, 主要功能被我移到: [jinxing/yii2-...
采用的方式是分析框架的源代码,尝试从根上进行理解和阐述,并融入个人使用Yii开发的一些经验和教训。 通过本书,你将不仅仅了解到Yii怎么使用的实操技巧,还将掌握其实现的技术原理和内幕。 更为重要的是,接触...
1. **安装与配置**:介绍如何在服务器上安装Yii,以及设置基本的项目环境。 2. **快速入门**:通过一个简单的“Hello, World!”示例来引导开发者了解Yii的基本结构和工作原理。 3. **基础概念**:详细讲解MVC模式,...
1. **框架结构**:禅道基于PHP语言,可能使用了诸如Yii或Laravel等流行的PHP框架,这决定了其代码组织和执行效率。通过源代码,开发者可以了解其选择的框架以及如何在项目中有效利用这些框架的优势。 2. **数据库...
解压后,开发者可以查看源代码,了解框架内部的工作机制,也可以根据需求进行自定义修改。此外,版本号中的“r3324”表示这是框架的第3324次提交,反映了框架的持续改进和更新。 “yii框架中文手册教程.pdf”是Yii...
在文件名称列表 "ytwo" 中,可能包含了该后台系统的源代码文件,例如配置文件、模型类、控制器、视图文件、公共函数库等。开发者可以通过查看这些文件深入了解系统架构和实现细节,以便进行二次开发或定制。 总的来...
1. **Yii2框架与Swoole的集成**:Yii2swoole是将Yii2框架与Swoole进行整合的扩展,允许Yii2应用利用Swoole的高性能特性。它提供了在Swoole环境下运行Yii2的基础设施,包括请求处理、事件监听、session和cookie管理等...
附录部分通常包含了对文档中未详细说明的内容的补充,例如对源代码的额外说明、配置项的解释、或者对某些操作的高级技巧等。 以上便是Yii框架学习笔记的核心内容,涵盖了从基础入门到高级特性的全面知识点。通过...
1. **yiisoft/yii2**: 框架的核心组件,包括MVC(模型-视图-控制器)架构、数据库访问层、缓存机制、身份验证和授权等。 2. **Composer配置文件**:用于管理依赖和自动加载类库。 3. **基础应用模板**:提供一个基本...
学习源代码,你可以理解变量声明、数据类型、控制结构(如if/else,switch)、循环(for,while,do/while)以及函数的使用。 2. **面向对象编程**:第三版可能加强了对面向对象编程的支持,包括类、对象、继承、...
1. **性能优化**:Yii 使用缓存机制,如APC、Memcached或数据库缓存,来提高应用性能。此外,其代码经过精心设计和优化,确保在处理大量请求时依然快速响应。 2. **MVC(模型-视图-控制器)架构**:Yii 实现了MVC...
Yii采用MVC(Model-View-Controller)设计模式,这是Web应用开发中最常用的设计模式之一。在Yii中,Model负责处理数据和业务逻辑,View负责展示数据,而Controller则协调Model和View,处理用户请求并生成响应。 类...