栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

PHP扩展开发[基础]

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

PHP扩展开发[基础]

tar zxvf php-5.4.6.tar.gz
cd php-5.4.6/ext/
./ext_skel –extname=say_hello
cd say_hello
vim config.m4
将“Otherwise use enable”下面三行的“dnl”去掉,改为:

dnl Otherwise use enable:
PHP_ARG_ENABLE(say_hello, whether to enable say_hello support,
Make sure that the comment is aligned:
[ --enable-say_hello Enable say_hello support])

vim say_hello.c

PHP_MINFO_FUNCTION(say_hello)
{
php_info_print_table_start();
php_info_print_table_header(2, “say_hello support”, “enabled”);
php_info_print_table_row(2, “author”, “linux”);
php_info_print_table_end();

}

PHP_FUNCTION(say_hello_func)
{
char *name;
int name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, “s”, &name, &name_len) == FAILURE)
{
return;
}
php_printf(“Hello %s!”, name);

RETURN_TRUE;
}

ZEND_BEGIN_ARG_INFO(arginfo_say_hello_func, 0)
ZEND_END_ARG_INFO()

const zend_function_entry say_hello_functions[] = {
PHP_FE(say_hello_func, arginfo_say_hello_func) //增加
};

/usr/bin/phpize
./configure
make
make install

vim /etc/php.ini
extension_dir = “/usr/lib/20100212″
extension = “say_hello.so”

;


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/228051.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号