应用操作-实现str_concat功能

应用操作-实现str_concat功能

实现str_concat功能PHP_FUNCTION(str_concat) { zend_string *prefix, *subject, *result; zval *string; if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &prefix, &string) == FAILURE) { return; } subject = zval_get_string(string); if (zend_bi...

自研拓展 2021-03-31 AM 1128℃ 0条
应用操作-判断传入参数的类型

应用操作-判断传入参数的类型

判断传入参数的类型#ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "zend_bitset.h" #include "ext/standard/php_var.h" #include "php_fuck.h" static int le_fuc...

自研拓展 2021-03-31 AM 1008℃ 0条
应用操作-接受传入的参数和输出返回值

应用操作-接受传入的参数和输出返回值

接受传入的参数和输出返回值#ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "zend_bitset.h" #include "ext/standard/php_var.h" #include "php_fuck.h" static int le...

自研拓展 2021-03-31 AM 1022℃ 0条
应用操作-数组循环遍历的详解

应用操作-数组循环遍历的详解

数组循环遍历的详解PHP_FUNCTION(fuck_rand) { ulong num_key; zend_string *key; zval *val, *arr; HashTable *arr_hash; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arr) == FAILURE) { RETURN_NULL(); } //初始化数组 arr_hash = Z_ARRVAL_P(arr); ...

自研拓展 2021-03-31 AM 964℃ 0条
应用操作-实现一个数组遍历打印值换行的拓展

应用操作-实现一个数组遍历打印值换行的拓展

实现一个数组遍历打印值换行的拓展PHP_FUNCTION(fuck_rand) { ulong num_key; zend_string *key; zval *val, *arr; HashTable *arr_hash; int array_count; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &arr) == FAILURE) { RETURN_NULL(); } arr_hash = Z...

自研拓展 2021-03-31 AM 1080℃ 0条
基础操作-MongoDb

基础操作-MongoDb

基础知识#创建数据库 use commentdb #选择数据库后,使用集合来对文档进行操作,插入文档语法格式 db.集合名称.insert(数据); #插入以下测试数据 db.comment.insert({content:"十次方课程",userid:"1011"}) #查询集合的语法格式 db.集合名称.find() #输入以下测试语句 db.comment.insert({_id:"1",content:"到底为啥出错",userid:"1012",thumbup:2020...

MongoDb 2021-03-29 PM 1114℃ 0条
array_column - 返回数组中指定的一列

array_column - 返回数组中指定的一列

array_column - 返回数组中指定的一列static inline zend_bool array_column_param_helper(zval *param,const char *name) { switch (Z_TYPE_P(param)) { case IS_DOUBLE: convert_to_long_ex(param); /* fallthrough */ case IS_LONG: return 1; case IS_OBJECT: convert_to_string...

PHP拓展数组 2021-03-29 AM 1052℃ 0条
array_change_key_case-将数组中的所有键名修改为全大写或小写

array_change_key_case-将数组中的所有键名修改为全大写或小写

array_change_key_case-将数组中的所有键名修改为全大写或小写#include "ext/standard/info.h" //php_string_toupper方法 PHP_FUNCTION(array_change_key_case) { zval *array, *entry; zend_string *string_key; zend_string *new_key; zend_ulong num_key; zend_long change_to_upper=0; if (zend_parse...

PHP拓展数组 2021-03-29 AM 990℃ 0条
array_rand-函数返回数组中的随机键名

array_rand-函数返回数组中的随机键名

array_rand-函数返回数组中的随机键名PHP_FUNCTION(array_rand){ zval *input; zend_long num_req = 1; zend_string *string_key; zend_ulong num_key; int i; int num_avail; zend_bitset bitset; int negative_bitset = 0; uint32_t bitset_len; ALLOCA_FLAG(use_heap) if (zend...

PHP拓展数组 2021-03-29 AM 1028℃ 0条
array_product - 函数计算并返回数组的乘积

array_product - 函数计算并返回数组的乘积

array_product - 函数计算并返回数组的乘积PHP_FUNCTION(array_product) { zval *input, *entry, entry_n; double dval; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(input) ZEND_PARSE_PARAMETERS_END(); ZVAL_LONG(return_value, 1); //使用宏Z_ARRVAL_P获取数组的值 ...

PHP拓展数组 2021-03-29 AM 960℃ 0条
array_reduce 函数向用户自定义函数发送数组中的值,并返回一个字符串

array_reduce 函数向用户自定义函数发送数组中的值,并返回一个字符串

array_reduce 函数向用户自定义函数发送数组中的值,并返回一个字符串PHP_FUNCTION(array_reduce){ zval *input; zval args[2]; zval *operand; zval result; zval retval; zend_fcall_info fci; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; zval *initial = NULL; HashTable *htbl; ...

PHP拓展数组 2021-03-29 AM 989℃ 0条