易截截图软件、单文件、免安装、纯绿色、仅160KB

php扩展多进程共享内存

步骤:
1.运行命令:./ext_skel --extname=sharemem
2.运行命令:./configure --with-php-config=/usr/local/lnmp/php/bin/php-config
3.make clean
make
make install
/usr/local/lnmp/php/sbin/php-fpm restart
/usr/local/lnmp/php/bin/php-cgi /data0/htdocs/blog/sharemem.php
代码如下:
1.config.m4
PHP_ARG_ENABLE(sharemem, whether to enable sharemem support,
Make sure that the comment is aligned:
[  --enable-sharemem           Enable sharemem support])
if test "$PHP_SHAREMEM" != "no"; then
 
  PHP_NEW_EXTENSION(sharemem, sharemem.c, $ext_shared)
fi
2.php_sharemem.h
#ifndef PHP_SHAREMEM_H
#define PHP_SHAREMEM_H
extern zend_module_entry sharemem_module_entry;
#define phpext_sharemem_ptr &sharemem_module_entry
#ifdef PHP_WIN32
#define PHP_SHAREMEM_API __declspec(dllexport)
#else
#define PHP_SHAREMEM_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
/*hanhhh*/
#include "sys/mman.h"
#include "fcntl.h"
#include "semaphore.h"
#define FILE_MODE   (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
/*hanhhh*/
typedef struct php_shared_mm {
  sem_t mutex;  /* the mutex: a Posix memory-based semaphore */
  int count;  /* and the counter */
} php_shared_mm;
PHP_MINFO_FUNCTION(sharemem);
PHP_FUNCTION(say8_count_add); /* For testing, remove later. */
PHP_FUNCTION(say8_count_dec); /* For testing, remove later. */
#endif /* PHP_SHAREMEM_H */
3.sharemem.c
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_sharemem.h"
zend_function_entry sharemem_functions[] = {
 PHP_FE(say8_count_add, NULL)  
 PHP_FE(say8_count_dec, NULL)  
 {NULL, NULL, NULL} /* Must be the last line in sharemem_functions[] */
};
/* }}} */
/* {{{ sharemem_module_entry
 */
zend_module_entry sharemem_module_entry = {
#if


相关文档:

php字符串修改(处理)函数总结

声明(本文转载自):http://www.phpzc.com/read.php?tid=643
ltrim();//去掉字符串左空格;
rtrim();//去掉字符串右空格;
trim(); //去掉字符串两边空格;
         //去掉空格是返回一个新的字符串;原字符串不变;
strlen();     //计算字符串长度; ......

PHP的TokyoTyrant扩展接口API文档(PECL)

手册的官方地址: http://us3.php.net/manual/en/book.tokyo-tyrant.php
具体内容如下:
TCT支持的追加参数:
mode:
bnum: 桶数组元素个数,如果不大于0,使用默认值, 默认值是131071, 建议值是所有存储的记录条数的0.5-4倍.
apow: 和一个key关联的记录数,如果是负值, 使用默认值, 默认值为4, 意为2的4次方.
fpow: FreeBl ......

php curl 简介


原文
(英文)地址:
http://www.phpit.net/article/using-curl-php
版权声明:署名-非商业性使
用-禁止演绎 2.0
摘要:
在这篇文章中主要讲解
php_curl库的知识,并教你如何更好的使用php_curl。
简介
你可能在你的编写PHP脚
本代码中会遇到这样的问题:怎么样才能从其他站点获取内容呢?这里有几个解决方式 ......

PHP 中 session 全面教程

一、session概述
    session是什么,刚开始我也不明白,非专业词典翻译为会议,会议期。直到接触asp后才知道session是干什么的,有什么用。作个不太恰当的比喻吧(虽然不恰当,但意义却是一样的),session就好象你和你女友(或妻子)之间的感情似的,session是你和网站之间的感情。
    se ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号