1. Extend your php2. Extended 3 ways 3. Extension DLL mode extension 4. Summary First, all of the following are under Win, VC 6.0 used for use, expand your phpphp The fast style has an important role in web system development. PHP itself provides a rich large number of functions and functions. Long-term short saying. Let's see how we expand. Extended 3 ways External ModulesBuilt-in ModulesThe Zend Engine3 way Excellent and disadvantages can be found in the PHP manual.http: //www.php.net/manual/en/zend.possibilities.phpextension dll1. First we go to the next PHP's source. You can see the following important directories .ext , Main, TSRM, Zend, and we may also need bindlib_w32 (you need you from cvs up and down), and PHP4Ts.lib2 under the PHP directory. Open VC, create a new Win32 Dynamic-Link Library, as shown in Figure 3. Point OK, select ' An Empty DLL Project ', And Click Finish.4. Setting Build's Active Configuration. Choose Release:) 5. Project-> settings. Predefined ID. The whole is as follows .zend_debug = 0, compile_dl_binzy, zts = 1, zend_win32, php_win32, Have_binzy = 1 This is a path that includes the path. The few paths mentioned above can be added. Select Multithreaded DLL, just casually, to be link php4tsts.lib ~~:) O, forget, don't forget to add / TC parameters. 6. Write code. Built a head, build a body. Binzy.h // binzy wu
// 2004-4-9
// PHP Extension
#if Have_binzy
EXTERN ZEND_MODULE_ENTRY BINZY_MODULE_ENTRY
#DEFINE BINZY_MODULE_PTR & BINZY_MODULE_ENTRY
PHP_Function (Hellobinzy); //
PHP_MINFO_FUNCTION (BINZY); //
# endifbinzy.c // binzy wu
// 2004-4-9
// PHP Extension
#include "php.h"
#include "binzy.h"
#if Have_binzy
#if compile_dl_binzy
Zend_get_Module (Binzy)
#ENDIF
Function_entry binzy_functions [] = {
PHP_fe (Hellobinzy, Null)
{Null, null, null}
}
ZEND_MODULE_ENTRY BINZY_MODULE_ENTRY = {
Standard_Module_Header,
"binzy", binzy_functions, null, null, null, null, php_minfo (binzy), no_version_yet, standard_module_properties
}
PHP_MINFO_FUNCTION (BINZY)
{
PHP_INFO_PRINT_TABLE_START ();
PHP_INFO_PRINT_TABLE_ROW (2, "Binzy Extension", "enable");
PHP_INFO_PRINT_TABLE_END ();
}
PHP_Function (Hellobinzy)
{
Zend_Printf ("Hello Binzy");
}
# ENDIF6. Compile ... Modify php.ini, restart apache, write a php
Hellobinzy ();
?>
Hoho ~~~ PHPINFO (); Summary This is a way you come back to step by step ~~. Slow down, some don't know. Even beginners. Binzy wu