Use c to expand your php to see how many websites are using php now. you can search for it and then you will be scared. I hope everyone will love php together. The younger brother has just learned how to expand. the calf has a try. Download php, decompress it, and cdextls finds a blue file, which indicates it is executable. ext_skel -- extnamerobert (you can name it at will here, my English name is robert). after running it, a new file will be generated, and your php will be expanded with c.
If you look at the number of websites using php, you can search for it and you will be scared. I hope everyone will love php together.
The younger brother has just learned how to expand. let's try it out.
1. Download php, decompress it, and run cd ext.
Ls
A blue file is found, which indicates that the file is executable.
./Ext_skel -- extname = robert (you can name it at will here. my english name is robert)
A new folder is generated after running.
2. Open the newly generated folder
Open the config. m4 file, find the PHP_ARG_WITH line, and remove the dnl before the three lines. dnl is the annotator.
: Wq
3. open the php_luoxin.h file, find the PHP_FUNCTION location, and add our own defined functions. we have added two new functions, luoxin and robert. the added code is:
PHP_FUNCTION (luoxin)
PHP_FUNCTION (robert)
: Wq
3. The core file in the jerry. c file is the definition file that implements the function logic. In lines around 156, refer to the confirm_jerry_compiled function to write the logic code of our new function. here is just a simple output character. a c master can write more powerful logic functions, to meet your needs.
PHP_FUNCTION (luoxin) {zend_printf ("This is luoxin function ");}
PHP_FUNCTION (robert) {zend_printf ("This is robert function ");}
Find the luoxin_functions function in the file and add the two previously set functions, luoxin and robert. the added code is:
PHP_FE (luoxin, NULL)
PHP_FE (robert, NULL)
Be sure to enter {NULL, NULL, NULL} before.
: Wq
4. Compile with phpize, which will be the same as installing memcache later
It's easy. you can use a self-written module.