PHP扩展开发学习资料汇总

PHP扩展开发资料汇总

在学习扩展开发的过程中,发现了很多有用的资料,在此与大家分享
安利一下本人博客

书籍

网上资源

PHP和 PECL 扩展的文档

获得帮助

这里有一个邮件列表和IRC频道可以获取帮助, 这两个在PECL website都有介绍

构建工具

不限于php扩展开发使用, John Calcote所写的 Autotools: a practitioner’s guide to Autoconf, Automake and Libtool, 对于扩展开发很有帮助。。

其他的 the GNU Manual for Autoconf and GNU Autoconf, Automake, and Libtool

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
PHP-CPP The PHP-CPP library is a C++ library for developing PHP extensions. It offers a collection of well documented and easy-to-use classes that can be used and extended to build native extensions for PHP. The full documentation can be found on http://www.php-cpp.com. Watch out: PHP 7 only! This library has been updated to work with PHP versions 7.0 and up. If you wish to create extensions for older PHP versions, use the PHP-CPP-LEGACY library instead. The PHP-CPP and PHP-CPP-LEGACY library have (almost) identical API's, so you can easily port extensions for PHP 5.* to PHP 7 and the other war around. ABOUT PHP-CPP is created and maintained by Copernica (www.copernica.com). We write our code mostly in PHP and C++ and needed an effective way to combine these two languages. That's where PHP-CPP comes in. Do you appreciate our work and are you looking for other high quality solutions? Then check out our other solutions: PHP-JS (www.php-js.com) Copernica Marketing Suite (www.copernica.com) MailerQ MTA (www.mailerq.com) Responsive Email web service (www.responsiveemail.com) The power of PHP-CPP Unlike regular PHP extensions - which are really hard to implement and require a deep knowledge of the Zend engine and pointer manipulation - extensions built with PHP-CPP are not difficult to develop at all. In fact, the only thing you need to do is write a function in C++, and the PHP-CPP library uses all the power offered by C++11 to convert the parameters and return values from your functions to/and from PHP: Php::Value hello_world() { return "hello world!"; } The function above is a native C++ function. With PHP-CPP you can export this function to PHP with only one single C++ method call: extension.add("hello_world", hello_world); Working with parameters and return values is just as easy: Php::Value my_plus(Php::Parameters &params) { return params[0] + params[1]; } The method call to export the above C++ function: extension.add("my_plus", my_plus, { Php::ByVal("a", Php::numericType), Php::ByVal("b", Php::numericType) }); The PHP-CPP library ensures that the variables from PHP (which internally are complicated C structures), are automatically converted into integers, passed to your function, and that the return value of your "my_plus" function is also converted back into a PHP variable. Type conversion between native C/C++ types and PHP variables is handled by PHP-CPP, using features from the C++11 language. It does not matter if your functions accept strings, integers, booleans or other native parameters: PHP-CPP takes care of the conversion. The return value of your function is also transformed by PHP-CPP into PHP. More complicated structures can be handled by PHP-CPP as well. If you would like to return a nested associative array from your function, you can do so too: Php::Value get_complex_array() { Php::Value r; r["a"] = 123; r["b"] = 456; r["c"][0] = "nested value"; r["c"][1] = "example"; return r; } The C++ function above is equivalent to the following function in PHP: function get_complex_array() { return array( "a" => 123, "b" => 456, "c" => array("nested_value","example") ); } More information and more examples are available on the official website: http://www.php-cpp.com.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值