PHP
<?php
// open database connection
@ $db = new mysqli($host, $user, $password, $database_name);
if (mysql_connect_error())
{
echo '';
exit;
}
// query
$result = $db->query($sql);
$num_results = $db->num_rows;
// data
$row = $result->fetch_assoc(); // row is array, $row['id']
// release database source
$result->free();
$db->close();
?>
Ïà¹ØÎĵµ£º
1¡¢°²×°libeven
memcachedµÄʹÓÃÐèÒªlibevenµÄÖ§³Ö£¬ÎÒÃǵÃÏÈ×°ÉÏlibeven¡£
¹Ù·½ÍøÕ¾£ºhttp://www.monkey.org/~provos/libevent/
libevent°²×°·½Ê½±È½Ï¼òµ¥:
./configure && make
make install
¼ì²éÊÇ·ñ ÒѾ°²×°
ls -l /usr/local/lib/ | grep even
2¡¢°²×°memcached
¹Ù·½ÍøÕ¾£ºhttp://ww ......
ƽʱÓà htmlspecialchars() À´¹ýÂËhtml, µ«ÊÇ°ÑhtmlµÄ×Ö·ûתÒåÁË,×îºóÏÔʾ³öÀ´µÄ¾ÍÊÇhtmlÔ´´úÂë, ÀûÓÃstrip_tags()¾Í¿ÉÒÔ°Ñhtml±êÇ©È¥³ýµô.
[php]
$str = 'harryxu
‘;
echo(htmlspecialchars($str) . ‘
‘);
echo(strip_tags($str));
// output:
// harryxu
// harryxu
?>
......
function get_web_page( $url )
{
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page ·µ»ØÍøÒ³
CURLOPT_HEADER => false, // ²»·µ»ØÍ·ÐÅÏ¢
CURLOPT_FOLLOWLOCATION => true, ......
Õâ¶Îʱ¼äÔÚ¿´¡¶PHPºÍMySQL Web¿ª·¢¡·Ò»Êé¿´µ½str_replace½²½â£¬Ò»¶ÎСÌáʾдµ½£º¿ÉÒÔΪstr_replaceµÄÈý¸ö¶¼Ê¹ÓÃÊý×é´«È룬µ«½²½â±È½Ï¼òµ¥£¬ÓÚÊǾö¶¨×Ô¼ºµÄÊÔÑéһϸú¯ÊýÔÚ¸÷¸ö²ÎÊý´«ÈëÊý×éʱµÄÖ´Ðнá¹û¡£
º¯ÊýÔÐÍ£ºmixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
needle£ ......
¡¡ 1¡¢ÓÃPHP´òÓ¡³öÇ°Ò»ÌìµÄʱ¼ä¸ñʽÊÇ2006-5-10 22:21:21(2·Ö)
¡¡¡¡2¡¢echo(),print(),print_r()µÄÇø±ð(3·Ö)
¡¡¡¡3¡¢Äܹ»Ê¹HTMLºÍPHP·ÖÀ뿪ʹÓõÄÄ£°å(1·Ö)
¡¡¡¡4¡¢Ê¹ÓÃÄÄЩ¹¤¾ß½øÐа汾¿ØÖÆ?(1·Ö)
¡¡¡¡5¡¢ÈçºÎʵÏÖ×Ö·û´®·×ª?(3·Ö)
¡¡¡¡--------------------------------------------------------------- ......