代码
- 注册 ini 设置到global_library变量(yaf.c)
STD_PHP_INI_ENTRY("yaf.library", "", PHP_INI_ALL, OnUpdateString, global_library, zend_yaf_globals, yaf_globals)
- 把global_library和local_library都传递给了loader的初始化方法(yaf_application.c)
if (YAF_G(local_library)) {
zend_string *global_library = strlen (YAF_G(global_library))?
zend_string_init(YAF_G(global_library), strlen(YAF_G(global_library)), 0) : NULL;
loader = yaf_loader_instance(&zloader, YAF_G(local_library), global_library);
if (global_library) {
zend_string_release(global_library);
}
} else {
zend_string *local_library, *global_library;
local_library = strpprintf(0, "%s%c%s", ZSTR_VAL(YAF_G(directory)), DEFAULT_SLASH, YAF_LIBRARY_DIRECTORY_NAME);
global_library = strlen(YAF_G(global_library))?
zend_string_init(YAF_G(global_library), strlen(YAF_G(global_library)), 0) : NULL;
loader = yaf_loader_instance(&zloader, local_library, global_library);
zend_string_release(local_library);
if (global_library) {
zend_string_release(global_library);
}
}
- 这里的local_library指的是application. ini文件 中设置的application.library 的值
如果没有设置application.library,就用application目录下的library作为local_library,就是常量YAF_LIBRARY_DIRECTORY_NAME定义的目录。
- yaf_loader_instance逻辑(yaf_loader.c) yaf_loader_instance有三个参数,loader的指针,本地类 地址 和全局类地址
if (library_path) { zend_update_property_str(yaf_loader_ce, instance, ZEND_STRL(YAF_LOADER_PROPERTY_NAME_LIBRARY), library_path); } if (global_path) { zend_update_property_str(yaf_loader_ce, instance, ZEND_STRL(YAF_LOADER_PROPERTY_NAME_GLOBAL_LIB), global_path); }
两个地址一起注册到yaf_loader_ce。
conclusion
定义的位置不影响加载效率。
I was wondering if you ever considered changing the structure of your site?
Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so
people could connect with it better. Youve got an awful lot of text foor only having
one or 2 pictures. Maybe you could space it out better?
Also vijsit my blog …