惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
MyScale Blog
MyScale Blog
博客园 - Franky
The Cloudflare Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
腾讯CDC
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
云风的 BLOG
云风的 BLOG

博客园 - bqrm_521(小奎)

.net连接eDirectory,需要安全连接的解决方案 ObDereferenceObjectDeferDelete routine ObDereferenceObject routine ObCloseHandle routine InitializeObjectAttributes 宏 Driver Support Routines(驱动程序开发支持例程) AdapterControl routine Standard Driver Routines(标准驱动程序) DriverEntry 文件系统过滤驱动的DriverEntry PHP扩展的加载流程 PHP扩展中定义一个类 PHP的HashTable(二) PHP的HashTable(一) 开发PHP扩展(一) 要搬家了,全部书籍10元转让 scribe2.2 ssh 使用技巧 安装scribe
PHP扩展中访问全局变量$_POST,$_GET,$_SERVER等
bqrm_521(小奎) · 2012-09-29 · via 博客园 - bqrm_521(小奎)

写扩展,离不了访问全局变量像$_POST,$_GET,$_SERVER等,

以下是YAF提供的代码,我把YAF相关的宏,去掉了...

  1 /**  YAF文档 http://yaf.laruence.com/manual/  **/

 2 
 3 
 4 zval * yaf_request_query(uint type, char * name, uint len TSRMLS_DC) {
 5     zval        **carrier, **ret;
 6 
 7 #if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 4)
 8     zend_bool   jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) && !PG(register_long_arrays));
 9 #else
10     zend_bool   jit_initialization = PG(auto_globals_jit);
11 #endif
12 
13     /* for phpunit test requirements */
14    switch (type) {
15         case TRACK_VARS_POST:
16         case TRACK_VARS_GET:
17         case TRACK_VARS_FILES:
18         case TRACK_VARS_COOKIE:
19             carrier = &PG(http_globals)[type];
20             break;
21         case TRACK_VARS_ENV:
22             if (jit_initialization) {
23                 zend_is_auto_global(ZEND_STRL("_ENV") TSRMLS_CC);
24             } 
25             carrier = &PG(http_globals)[type];
26             break;
27         case TRACK_VARS_SERVER:
28             if (jit_initialization) {
29                 zend_is_auto_global(ZEND_STRL("_SERVER") TSRMLS_CC);
30             } 
31             carrier = &PG(http_globals)[type];
32             break;
33         case TRACK_VARS_REQUEST:
34             if (jit_initialization) {
35                 zend_is_auto_global(ZEND_STRL("_REQUEST") TSRMLS_CC);
36             } 
37             (void)zend_hash_find(&EG(symbol_table), "_REQUEST"sizeof("_REQUEST")-1, (void **)&carrier);
38             break;
39         default:
40             break;
41     }
42 
43     if (!carrier || !(*carrier)) {
44         zval *empty;
45         MAKE_STD_ZVAL(empty);
46         ZVAL_NULL(empty);
47         return empty;
48     }
49 
50     if (!len) {
51         Z_ADDREF_P(*carrier);
52         return *carrier;
53     }
54 
55     if (zend_hash_find(Z_ARRVAL_PP(carrier), name, len + 1, (void **)&ret) == FAILURE) {
56         zval *empty;
57         MAKE_STD_ZVAL(empty);
58         ZVAL_NULL(empty);
59         return empty;
60     }
61     
62     Z_ADDREF_P(*ret);
63     return *ret;
64 }