The process-oriented interface to C alternatively C + + PHP package to use, this means that process-oriented package.
significance of the amplified archive PHP: PHP can not instantly use the C function, he absences to use their own memory treatment and parameter management, and therefore in the C code and PHP code, the will to use the functions and variables to make a an mapping.
package can be divided into 6 steps:
1. include the header document
2. Statement exported function
3. Statement zend function block
4. Statement zend module
5. apt attain get_module () function
6.
can watch the exported functions to achieve one of the most easy sample,
Womens Lacoste Observe Trainers, the source files were test.h and test.cpp, they produce extern_test.so. Then dynamically load the test.php dynamic correlate library.
*********************************************** **********
/ / test.h
# ifndef _EXTERN_TEST_H_
# define _EXTERN_TEST_H_
# include
/ / include the header file, which required the presentation of the macro, API definitions,
Lacoste Canvas Trainers, etc.
# ifdef __cplusplus
extern ; # embody ; ext / criterion / info.h ************************************************** ********
/ / test.cpp
# include {
ZEND_FE (extern_test_func, NULL)
NULL,
Successful Internet businesses are using the human,
Lacoste Swerve Trainers, NULL, NULL
};
/ / Declare zend module
zend_module_entry extern_test_module_entry =
STANDARD_MODULE_HEADER,
extern_test_functions,
NULL,
NULL,
NULL,
NULL,
ZEND_MINFO (extern_test),
Lacoste Radiate Croc Trainers,
EXTERN_TEST_VERSTR,
Lacoste Trainers,
STANDARD_MODULE_PROPERTIES
;
/ / implementation get_module () function
# ifdef __cplusplus
BEGIN_EXTERN_C ()
# endif
ZEND_GET_MODULE (extern_test)
# ifdef __cplusplus
END_EXTERN_C ()
# endif
ZEND_MINFO_FUNCTION (extern_test)
/ / backup functions to achieve
ZEND_FUNCTION (extern_test_func)
{
int iInt = 0;
if (ZEND_NUM_ARGS () == 1) {
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC,
Lacoste Gravitate Trainers, RETURN_LONG (ERR_PARAM_NUM);
}
} else
RETURN_LONG (ERR_PARAM_NUM);
RETURN_LONG (iInt) ;
}
****************************************** ******************
************************************ ************************
the php program execution, it ambition output