Expand your PHP Introductory Chapter

Source: Internet
Author: User
Tags manual functions include zend
1. Extend Your PHP
2.3 Modes of expansion
3. Extension of extension DLL mode
4. Summary

First of all, all of the following are carried out under win, using the tools of the vc++6.0.
Expand your PHP
PHP quickly and quickly in the style of the development of the web system occupies an important position. PHP itself provides a wealth of functions and functions. Short. Let's see how we can expand.

3 Ways to expand
External Modules
Built-in Modules
The Zend Engine
3 ways to see the pros and cons of the PHP manual. http://www.php.net/manual/en/zend.possibilities.php

Extension DLL

1. First we go to the next PHP source. You can see that there are several important directories here.
Ext, Main, TSRM, Zend, in addition we may also need bindlib_w32 (need you up and down from CVS), and the PHP directory of Php4ts.lib

2. Open VC, a new Win32 Dynamic-link Library, the following figure



3. Click OK, select ' An Empty Dll Project ', and click Finish.

4. Set the active Configuration of the build. Select release:)



5. Project->settings.



Predefined identities. The whole is as follows. Zend_debug=0,compile_dl_binzy,zts=1,zend_win32,php_win32,have_binzy=1



This is the inclusion path, and several of the paths mentioned above can be added.



Select the multithreaded DLL,



The name of the casual, to link php4ts.lib~~:)
O, forget, don't forget to add the/TC parameter.



6. Write code.

Build and 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); //
#endif



Binzy.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");
}

#endif


6. Compile ... Modify PHP.ini, restart Apache, write PHP


?
Hellobinzy ();
?>



hoho~~~




Phpinfo ();



Summary
This is an introductory article, and then step by step ~ ~. Slowly and deeply, some I do not understand. I am a beginner.

Binzy Wu

Have any questions please go to the discussion area to participate in this article discussion: http://club.phpe.net/index.php?act=ST&f=15&t=4809

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.