Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¿ìËÙ¿ª·¢Ò»¸öPHPÀ©Õ¹

 ¿ìËÙ¿ª·¢Ò»¸öPHPÀ©Õ¹
 
±¾ÎÄͨ¹ý·Ç³£¿ìËٵķ½Ê½½²½âÁËÈçºÎÖÆ×÷Ò»¸öPHP 5.2 »·¾³µÄÀ©Õ¹£¨PHP Extension£©£¬Ï£ÍûÄܹ»ÔÚͼÎĵķ½Ê½ÏÂÈÃÏë¿ìËÙѧϰµÄÅóÓÑÁ˽âÒ»ÏÂÖÆ×÷¹ý³Ì¡£
ÐèÇ󣺱ÈÈ翪·¢Ò»¸ö½Ð×ö heiyeluren  µÄÀ©Õ¹£¬À©Õ¹Àï¾ÍÒ»¸öº¯Êý heiyeluren_test()£¬ÊäÈëÒ»¸ö×Ö·û´®£¬º¯Êý·µ»Ø£ºYour input string: xxxxx¡£
ÒªÇó£ºÁ˽âC/C++±à³Ì£¬ÊìϤPHP±à³Ì
»·¾³£ºÏÂÔØÒ»·Ýphp¶ÔÓ¦°æ±¾µÄÔ´Â룬ÎÒÕâÀïÊÇ php-5.2.6£¬ÏÈÕý³£°²×°php£¬¼ÙÉèÎÒÃǵÄphp°²×°ÔÚ /usr/local/php Ŀ¼£¬Ô´ÂëÔÚ /root/soft/php/php-5.2.6/£¬ÏÖÔÚ¿ªÊ¼£¡
²½ÖèÒ»£ºÉú³ÉÀ©Õ¹¿ò¼Ü
cd /root/soft/php/php-5.2.6/ext
./ext_skel --extname=heiyeluren
cd /root/soft/php/php-5.2.6/ext/heiyeluren
vi config.m4
´ò¿ªÎļþºóÈ¥µô dnl £¬»ñµÃÏÂÃæµÄÐÅÏ¢£º
PHP_ARG_ENABLE(heiyeluren, whether to enable heiyeluren support,
[  --enable-heiyeluren           Enable heiyeluren support])
±£´æÍ˳ö.
(ͼ01)
 
µÚ¶þ²½£º±àд´úÂë
vi php_heiyeluren.h
ÕÒµ½£ºPHP_FUNCTION(confirm_heiyeluren_compiled); £¬ÐÂÔöÒ»ÐУº
PHP_FUNCTION(heiyeluren_test);
±£´æÍ˳ö¡£
(ͼ02)
vi heiyeluren.c
Êý×éÀïÔö¼ÓÎÒÃǵĺ¯Êý£¬ÕÒµ½ zend_function_entry heiyeluren_functions[]£¬Ôö¼Ó£º
PHP_FE(heiyeluren, NULL)
(ͼ03)
ÔÙµ½ heiyeluren.c Îļþ×îºóÃæÔö¼ÓÈçÏ´úÂ룺
PHP_FUNCTION(heiyeluren_test)
{
    char *arg = NULL;
    int arg_len, len;
    char *strg;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
        return;
    }
    len = spprintf(&strg, 0, "Your input string: %s\n", arg);
    RETURN_STRINGL(strg, len, 0);
}
±£´æÍ˳ö¡£
(ͼ04)
µÚÈý²½£º±àÒë°²×°
cd /root/soft/php/php-5.2.6/ext/heiyeluren
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make test
make install
ÏÖÔÚ¿´¿´ÊDz»ÊÇÓиö /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/heiyeluren.so
±à¼­php.ini£¬°Ñ


Ïà¹ØÎĵµ£º

phpÖÐecho()£¬print()£¬print_r()µÄÇø±ð

1.echo()ÊÇÒ»¸öphpÓï¾ä£¬ËùÒÔûÓзµ»ØÖµ£¬ÄÜ´òÓ¡¼òµ¥µÄÊý¾Ý¡£
2.print()ÊÇÒ»¸öº¯Êý£¬Óзµ»ØÖµ£¬ÄÜ´òÓ¡¼òµ¥µÄÊý¾Ý¡£
3.print_r()ÊÇÒ»¸öº¯Êý£¬ÄÜ´òÓ¡¸´ÔÓµÄ(mix)Êý¾Ý¡£
È磺
<?
$value = print 'hello word<br>';
echo "the value is $value<br>";
$arr = array('name'=>'wangking','qq'=>'12345 ......

ÍøվģÄâµÇ½±¸Íü£¨php + python£©

 php°æ£º
<?php
$cookie_file = fopen('cookie.txt','w');//dirname(__FILE__)."/cookie_".md5(basename(__FILE__)).".txt"; // ÉèÖÃCookieÎļþ±£´æ·¾¶¼°ÎļþÃû

function vlogin($url,$data){ // Ä£ÄâµÇ¼»ñÈ¡Cookieº¯Êý
$curl = curl_init(); // Æô¶¯Ò»¸öCURL»á»°
curl_setopt($cur ......

PHPÊý¾Ý¿âµÄ²Ù×÷


1. ½¨Á¢ºÍ¹Ø±ÕÁ¬½Ó
1) mysql_connect()
    resource mysql_connect([string hostname [:port][:/path/to/socket][,string username] [,string password]])
    ËùÓвÎÊý¶¼ÊÇ¿ÉÑ¡µÄ
    ¾ÙÀý:
    @mysql_connect("localhost", "user", "password")
......

PHP Ϊʲôfunction


PHP Ϊʲôfunction ÔÚÉùÃ÷ʱûÓÐÉùÃ÷²ÎÊý,¶øµ÷ÓÃʱ¼ÓN¸ö²ÎÊýÈ´ÊÇÔÊÐíµÄ
2008-11-13 20:14:38    ÆäËû |  ÆÀÂÛ(7) |  ä¯ÀÀ(721)
ÈçÌâ
//ÉùÃ÷
function test(){};
$a = '';
$b = '';
$c = '';
//µ÷ÓÃ
test($a,$b,$c,1,2,3);
ÏàÐŲ»ÉÙÐֵܽãÃÃÒ²Ôø¾­Óöµ½Í¬ÑùµÄÎÊÌâ¡£
why?
¸Õ¿ªÊ¼ÎÒÒ²Í¦Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ