찾다
php教程PHP开发PHP 커널 분석(3) - 전역 변수

요약: 여기서 읽는 PHP 버전은 PHP-7.1.0 RC3이고, 코드를 읽는 플랫폼은 linux입니다. CGCG는 컴파일 과정에서 사용되는 전역 변수를 저장하는 전역 컴파일러_global에서 속성 값을 얻습니다. struct _zend_compiler_globals { zend_stack loop_var_stack; zen...

여기서 읽는 PHP 버전은 PHP-7.1.0 RC3이고, 코드를 읽는 플랫폼은 linux

CG

CG는 컴파일 프로세스에 사용되는 전역 변수를 저장하는 전역 컴파일러_global에서 속성 값을 가져옵니다.

01    struct _zend_compiler_globals {    
02        zend_stack loop_var_stack;    
03    
04        zend_class_entry *active_class_entry;    
05    
06        zend_string *compiled_filename;    
07    
08        int zend_lineno;    
09    
10        zend_op_array *active_op_array;    
11    
12        HashTable *function_table;    /* function symbol table */    
13        HashTable *class_table;        /* class table */    
14    
15        HashTable filenames_table;    
16    
17        HashTable *auto_globals;    
18    
19        zend_bool parse_error;    
20        zend_bool in_compilation;    
21        zend_bool short_tags;    
22    
23        zend_bool unclean_shutdown;    
24    
25        zend_bool ini_parser_unbuffered_errors;    
26    
27        zend_llist open_files;    
28    
29        struct _zend_ini_parser_param *ini_parser_param;    
30    
31        uint32_t start_lineno; // 执行文件开始执行的行号    
32        zend_bool increment_lineno;    
33    
34        zend_string *doc_comment;    
35        uint32_t extra_fn_flags;    
36    
37        uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */    
38    
39        HashTable const_filenames;    
40    
41        zend_oparray_context context;    
42        zend_file_context file_context;    
43    
44        zend_arena *arena;    
45    
46        zend_string *empty_string;    
47        zend_string *one_char_string[256];    
48        zend_string **known_strings;    
49        uint32_t    known_strings_count;    
50    
51        HashTable interned_strings;    
52    
53        const zend_encoding **script_encoding_list;    
54        size_t script_encoding_list_size;    
55        zend_bool multibyte;    
56        zend_bool detect_unicode;    
57        zend_bool encoding_declared;    
58    
59        zend_ast *ast;    
60        zend_arena *ast_arena;    
61    
62        zend_stack delayed_oplines_stack;    
63    
64    #ifdef ZTS    
65        zval **static_members_table;    
66        int last_static_member;    
67    #endif    
68    };

SG

01    SG是从全局的sapi_global中获取属性值    
02    
03    // TODO:更新    
04    typedef struct _sapi_globals_struct {    
05        void *server_context;    
06        sapi_request_info request_info; // 请求信息    
07        sapi_headers_struct sapi_headers;    
08        int64_t read_post_bytes;    
09        unsigned char post_read;    
10        unsigned char headers_sent;    
11        zend_stat_t global_stat;    
12        char *default_mimetype;    
13        char *default_charset;    
14        HashTable *rfc1867_uploaded_files;    
15        zend_long post_max_size;    
16        int options;    
17        zend_bool sapi_started;    
18        double global_request_time;    
19        HashTable known_post_content_types;    
20        zval callback_func;    
21        zend_fcall_info_cache fci_cache;    
22    } sapi_globals_struct;

EG

EG는 executor_globals에서 변수를 얻습니다.

01    // TODO: 更新    
02    struct _zend_executor_globals {    
03        zval uninitialized_zval;    
04        zval error_zval;    
05    
06        /* symbol table cache */    
07        zend_array *symtable_cache[SYMTABLE_CACHE_SIZE];    
08        zend_array **symtable_cache_limit;    
09        zend_array **symtable_cache_ptr;    
10    
11        zend_array symbol_table;        /* main symbol table */    
12    
13        HashTable included_files;    /* files already included */    
14    
15        JMP_BUF *bailout;    
16    
17        int error_reporting;    
18        int exit_status;    
19    
20        HashTable *function_table;    /* function symbol table */    
21        HashTable *class_table;        /* class table */    
22        HashTable *zend_constants;    /* constants table */    
23    
24        zval          *vm_stack_top;    
25        zval          *vm_stack_end;    
26        zend_vm_stack  vm_stack;    
27    
28        struct _zend_execute_data *current_execute_data;    
29        zend_class_entry *fake_scope; /* used to avoid checks accessing properties */    
30    
31        zend_long precision;    
32    
33        int ticks_count;    
34    
35        HashTable *in_autoload;    
36        zend_function *autoload_func;    
37        zend_bool full_tables_cleanup;    
38    
39        /* for extended information support */    
40        zend_bool no_extensions;    
41    
42        zend_bool vm_interrupt;    
43        zend_bool timed_out;    
44        zend_long hard_timeout;    
45    
46    #ifdef ZEND_WIN32    
47        OSVERSIONINFOEX windows_version_info;    
48    #endif    
49    
50        HashTable regular_list;    
51        HashTable persistent_list;    
52    
53        int user_error_handler_error_reporting;    
54        zval user_error_handler;    
55        zval user_exception_handler;    
56        zend_stack user_error_handlers_error_reporting;    
57        zend_stack user_error_handlers;    
58        zend_stack user_exception_handlers;    
59    
60        zend_error_handling_t  error_handling;    
61        zend_class_entry      *exception_class;    
62    
63        /* timeout support */    
64        zend_long timeout_seconds;    
65    
66        int lambda_count;    
67    
68        HashTable *ini_directives;    
69        HashTable *modified_ini_directives;    
70        zend_ini_entry *error_reporting_ini_entry;    
71    
72        zend_objects_store objects_store;    
73        zend_object *exception, *prev_exception;    
74        const zend_op *opline_before_exception;    
75        zend_op exception_op[3];    
76    
77        struct _zend_module_entry *current_module;    
78    
79        zend_bool active;    
80        zend_bool valid_symbol_table;    
81    
82        zend_long assertions;    
83    
84        uint32_t           ht_iterators_count;     /* number of allocatd slots */    
85        uint32_t           ht_iterators_used;      /* number of used slots */    
86        HashTableIterator *ht_iterators;    
87        HashTableIterator  ht_iterators_slots[16];    
88    
89        void *saved_fpu_cw_ptr;    
90    #if XPFPA_HAVE_CW    
91        XPFPA_CW_DATATYPE saved_fpu_cw;    
92    #endif    
93    
94        zend_function trampoline;    
95        zend_op       call_trampoline_op;    
96    
97        void *reserved[ZEND_MAX_RESERVED_RESOURCES];    
98    };

위는 PHP 커널 분석입니다. (3) - 전역 변수 내용, 더 많은 관련 내용은 PHP 중국어 홈페이지(www.php.cn)를 참고해주세요!


성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

SublimeText3 Linux 새 버전

SublimeText3 Linux 새 버전

SublimeText3 Linux 최신 버전

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기