Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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¹¹Ô캯Êý


¡¡¡¡¹¹Ô캯ÊýÊÇPHPÖÐ×ÜÒªµÄ»ù±¾Óï·¨£¬Ê²Ã´Êǹ¹Ô캯ÊýÄØ?ÎÒÃÇÕâÀï¾ÍÒ»ÆðÀ´¿´¿´PHP¹¹Ô캯Êý¡£Èç¹ûÄãÔÚÒ»¸öÀàÖÐÉùÃ÷Ò»¸öº¯Êý,ÃüÃûΪ__construct,Õâ¸öº¯Êý½«±»µ±³ÉÊÇÒ»¸ö¹¹Ô캯Êý²¢ÔÚ½¨Á¢Ò»¸ö¶ÔÏóʵÀýʱ±»Ö´ÐÐ.Çå³þµØËµ,__ÊÇÁ½¸öÏ»®Ïß.¾ÍÏñÆäËüÈκκ¯ÊýÒ»Ñù,¹¹Ô캯Êý¿ÉÄÜÓвÎÊý»òÕßĬÈÏÖµ.Äã¿ÉÒÔ¶¨ÒåÒ»¸öÀàÀ´½¨Á¢Ò»¸ö¶ÔÏó²¢½ ......

ÔÚphpͼƬÖÐÊäÈëÖÐÎÄÎÄ×Ö½â¾öÂÒÂë

´úÂ룺
<?php
$im = imagecreatefromjpeg("ok.jpg");
$black = @imagecolorallocate($im, 0,0,0);
$jpgnumid = "ÕâÊÇǶÈ뵽ͼƬµÄÎÄ×Ö£¬½â¾öÁËÂÒÂëÎÊÌâ,
ÉÏÃæµÄok.jpgÊÇͬĿ¼ÏµÄÕÕÆ¬.ʹÓÃËüʱ£¬»¹ÐèÒªÓÐiconv
Ä£¿é£¡Ò²¾ÍÊÇ˵ÔÚphp.iniÀォ
[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encodin ......

PHP½«Ð¡Ð´¸Ä³É´óд½ð¶î

<?
error_reporting(2047);#±¨¸æËùÓзǷ¨µÄ´íÎó
ob_start();
function RMB ($RMB=0,$Format='') {
/*
*/
$RMB=@preg_Replace(
array('/([, ]|£¤|0$|)/','/(.){2,}/'),
array('','.'),
$RMB);
if(eregi("[^0-9.]",$RMB))return "·Ç·¨½ð¶î";
if($RMB==0)retur ......

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½Å
±¾´úÂëÖлáÓöµ½ÕâÑùµÄÎÊÌ⣺ÔõôÑù²ÅÄÜ´ÓÆäËûÕ¾µã»ñÈ¡ÄÚÈÝÄØ£¿ÕâÀïÓм¸¸ö½â¾ö·½Ê½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ