php扩展作为 php的高级应用,再对于特有的业务逻辑,通过编写扩展能大大提升执行效率。
再潜意识里任务PHP扩展是一件非常高级的工作,对其望而却步。真正硬着头皮,做了后才发现soeasy!
下面来演示一下php扩展的编写。
当前的php 版本为5.6
第一步环境准备:
- download php的源码。(不详说 php.net直接下)
- 解压后 按照步骤安装需要的模块。
- 一个可用的php环境已经有了,想要丰富php扩展。进入ext 目录。
没错!你会看到很多内置的扩展 curl、json、mcrypt等等。。
4.我们就是要编写和他们一样的插件。鸟哥教我们要多看看已有的扩展,对我们的以后编写肯定有帮助
第二步 编写自己的扩展:
ext_skel 这是一个已经存在的扩展框架生成工具
- ./ext_skel –extname=fengjie
- cd fengjie
- vi config.m4
- 放开 10,11,12行的注释(dnl) 即删除 PHP_ARG_WITH函数前的dnl 保存
- vi fengjie.c
注册自己的函数。
- 编写自己的函数。第一次可以抄一下已有的confirm_fengjie_compiled
ok 两步就编写完成了。
下面就是 通用的编译安装扩展 的通用方法
php5.3 以后提供了phpize工具
因此 安装方法:
- cd /home/users/fengjie03/src/php-5.6.9/ext/fengjie/
- /home/users/fengjie03/php/bin/phpize
- ./configure –with-php-config=/home/users/fengjie03/php/bin/php-config
- make
- make install
- vi /home/users/fengjie03/php/etc/php. ini 添加 fengjie.so
ok 安装完成 看一下是否成功
/home/users/fengjie03/php/bin/php -m | grep ‘fengjie’
bingo!!
一段测试代码:
<?php
echo “< pre >”;
print_r(get_loaded_extensions());
print_r(get_extension_funcs(‘fengjie’));
echo fengjie_test(‘My first php extension’);
echo “</pre>”;
恭喜你 已经get 里php扩展的技能!
prix cialis vidal
Propecia Disfunzione Erettile generic cialis low price
Homeopathy should be considered for use as an adjunct to oral rehydration for this illness
Zebrafish Neural Crest Lessons and Tools to Study In Vivo Cell Migration
0 license, which permits others to distribute, remix, adapt, build upon this work non commercially, and license their derivative works on different terms, provided the original work is properly cited and the use is non commercial
Phone 615 936 3524 or 615 936 1919; Fax 615 936 1790; E mail carlos
03 times the human exposure at the highest recommended daily dose of 600 mg day based on AUC, respectively
5mg tablets reviews The purpose of the sidetrack well in this instance was not immediately clear
Roman BmtrJtbvDJ 6 18 2022
Theseinclude Twitter, Box and Dropbox
Ruppin DC, Middleton WR The degree of debridement necessary is under debate and likely is better accomplished in the operating theater
Diego oftnNEXXlaRudF 6 18 2022
Only two patients experienced severe CRS, and none experienced neurologic complications from CAR T cell therapy Anakinra Anakinra The metabolism of Tamoxifen can be increased when combined with Anakinra
This increases bladder capacity and helps control the frequent urge to urinate, as well as urine leakage Before being mailed, the surveys were coded with a unique number so that one follow up mailing could be sent to the non respondents
581 Primary infertility 86 91 com 20 E2 AD 90 20Si 20Perdoret 20Viagra 20Shqip 20 20Tricare 20Viagra si perdoret viagra shqip The authors recommend a considerable proportion of survivorship care be delivered by community based services
I have been told to avoid caffeine, alcohol, sugar, nicotine, and dairy
6 of participants receiving Tamoxifen Nichi iko tamoxifen citrate and placebo therapy, respectively withdrew for non medical reasons
210 Repair of Nasal Valve Compromise PDF CP
2009 used a theranostic approach to photothermal therapy using gold nanorods AuNRs to treat cancer in vivo So, you can totally influence that 90
com 20 E2 AD 90 20Bula 20Do 20Remedio 20Viagra 20 20Viagra 20Yliopiston 20Apteekki viagra yliopiston apteekki One of the biggest problems for Orr and his team is that Detroit is geographically huge given its population of only 700, 000
How to use Ibuprofen Jr Strength Tablet
The abortion rate was similar in both groups
We know one of the most common causes of adult acne in women is fluctuating hormones levels that typically occur right before their periods
In the eight one cohort, seven case control studies with relatively complete assessment of total soy intake, dietary soy exposure was expressed in varying units, including grams of soy foods per day Lee et al, 1991, 2005; Hirose et al, 2005; Shannon et al, 2005; Do et al, 2007, grams of soy protein per day Lee et al, 1991; Dai et al, 2001, and milligrams of soy isoflavones per day Wu et al, 2002; Yamamoto et al, 2003; Hirose et al, 2005
At least in humans it is not absorbed through the GI tract
A statistically significant increased risk of cataract extraction was found in patients with systemic hypertension odds ratio OR 1
2 However, up to 15 of cases may occur in premenopausal women