z);
}
PHP_FUNCTION(b)
{
char *str = NULL;
int argc = ZEND_NUM_ARGS();
int str_len;
long n;
char *result;
char *ptr;
int result_length;
if (zend_parse_parameters(argc TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE)
return;
result_length = str_len * n;
result = (char *) emalloc(result_length + 1);
ptr = result;
while (n--) {
memcpy(ptr, str, str_len);
ptr += str_len;
}
*ptr = ''\0'';
RETURN_STRINGL(result, result_length, 0);
}
三、编译安装,假设php的安装目录为:/usr/localhost/webserver/php
#> cd /software/php-5.2.13/ext/caleng_module
#> /usr/localhost/webserver/php/bin/phpize
#> ./configure --with-php-config=/usr/localhost/webserver/php/bin/php-config
#> make
#> make install
现在将在/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613目录下生成caleng_module.so文件
在php.ini配置文件中加入: extension=caleng_module.so.
搞定收工