快速开发一个PHP扩展
程序员文章站
2022-04-29 19:05:22
...
本文通过非常快速的方式讲解了如何制作一个PHP 5.2 环境的扩展(PHP Extension),希望能够在图文的方式下让想快速学习的朋友了解一下制作过程。
需求:比如开发一个叫做 heiyeluren 的扩展,扩展里就一个函数 heiyeluren_test(),输入一个字符串,函数返回:Your input string: xxxxx。
要求:了解C/C++编程,熟悉PHP编程
环境:下载一份php对应版本的源码,我这里是 php-5.2.6,先正常安装php,假设我们的php安装在 /usr/local/php 目录,源码在 /root/soft/php/php-5.2.6/,现在开始!
步骤一:生成扩展框架
cd /root/soft/php/php-5.2.6/ext
./ext_skel --extname=heiyeluren
cd /root/soft/php/php-5.2.6/ext/heiyeluren
vi config.m4
打开文件后去掉 dnl ,获得下面的信息:
PHP_ARG_ENABLE(heiyeluren, whether to enable heiyeluren support,
[ --enable-heiyeluren Enable heiyeluren support])
保存退出.
推荐阅读
-
php开发文档怎么写(php扩展开发参考手册)
-
EpiiAdmin 开源的php交互性管理后台框架, 让复杂的交互变得更简单!Phper快速搭建交互性平台的开发框架,基于Thinkphp5.1+Adminlte3.0+Require.js。
-
php开发文档怎么写(php扩展开发参考手册)
-
php实现基于微信公众平台开发SDK(demo)扩展的方法
-
PHP扩展开发教程(总结)
-
如何让python嵌入html实现类似php的快速开发,十分有价值
-
国产PHP开发框架myqee新手快速入门教程
-
Linux 下编写一个 PHP 扩展
-
【实战】如何通过html+css+mysql+php来快速的制作动态网页(以制作一个博客网站为列)
-
php扩展开发入门demo示例