PHPÊý¾ÝÀàÐ͵Äת»»
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/02/09/1-12/
PHPµÄÊý¾ÝÀàÐ͵Äת»»ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ°ìµ½£ºÖ±½ÓÊäÈëÄ¿±êµÄÊý¾ÝÀàÐͺÍͨ¹ýsettypeº¯ÊýʵÏÖ¡£
PHPÊý¾Ýת»»³ÉÕûÊý
FloatÐÍÊý¾Ýת»»³ÉintÐÍ
FloatÐÍת»»³ÉintÐÍ£¬Ð¡ÊýµãºóµÄÊý½«±»ÉáÆú¡£Èç¹ûfloatÊý³¬¹ó³¬¹ýÁËÕûÐ͵ÄÈ¡Öµ·¶Î§£¬ÄÇô½á¹û¿ÉÄÜÊÇ0»òÕßÊÇÕûÐεÄ×îС¸ºÊý¡£
ÀýÈ磺
<?php
$php = 1.59;
echo (int)$php.”\n”;
$phpdo = 2.93E30; //³¬³öÕûÊýµÄÈ¡Öµ·¶Î§
echo (int)$phpdo.”\n”;
?>
½á¹û£º
1 0
BoolÐÍÊý¾Ýת»»³ÉÕûÐÍ
TRUEת»»Îª1£¬FALSEת»»³É0.
ÀýÈ磺
<?php
$php = true;
echo (int)$php.”\n”;
$phpdo = false;
echo (int)$phpdo.”\n”;
?>
½á¹û£º
1 0
StringÐÍÊý¾Ýת»»³Éint
¶ÔstringÊý¾Ý×ó²àµÄµÚһλÅжϣºÈç¹ûµÚһλÊÇÊý×Ö£¬Ôò½«¶ÁÈ¡µ½µÄÊý×Öת»»Îªint£¬Èç¹ûµÚһλ²»ÊÇÊý×Ö£¬Ôò½á¹ûΪ0.
ÀýÈ磺
<?php
$a = “100″;
echo (int)$a.”\n”;
$b = “phpdo.net”;
echo (int)$b.”\n”;
$c = “phpdo.net 100″;
echo (int)$c.”\n”;
$d = “100phpdo.net”;
echo (int)$d.”\n”;
$e = “1phpdo.net00″; //ֻȡ1£¬ºóÃæµÄÕûÊýÈ¡²»ÉÏ
echo (int)$e.”\n”;
?>
½á¹û£º
100 0 0 100 1
×¢Ò⣺Èç¹ûÊÇÊý×ÖºÍ×Öĸ»ìºÏ£¬È磺1phpdo.net00£¬ÔòÖ»ÓГ1”¿ÉÒÔ¶ÁÈ¡¡£
PHPÊý¾Ýת»»³ÉfloatÐÍ
ʹÓã¨float£©½øÐÐÇ¿ÖÆת»»
PHPÊý¾Ýת»»³Éstring
ʹÓã¨string£©½øÐÐÇ¿ÖÆת»»
IntÐÍÊý¾Ý×Ô²»±Ø˵£¬½á¹û¼´ÎªÆäÖµ£»Èç¹û±»×ª»»µÄ±äÁ¿ÎªbooleÐÍ£¬ÔòTRUE½«×ª»»³É×Ö·û´®“1”£¬FALSE½«×ª»»³É¿Õ´®£»Èç¹û±»×ª»»µÄÊÇobjecÐÍÊý¾Ý»òÕßarrayÐÍÊý¾Ý£¬Ôòת»»½á¹ûΪ×Ö·û´®¶ÔÏó»ò×Ö·û´®Êý×飻Èç¹û±»×ª»»µÄ¶ÔÏóΪ×ÊÔ´ÐÍÊý¾Ý£¬Ôòת»»½á¹ûΪһ¸öÀàËÆ“resource id #”µÄ×Ö·û´®£¨idΪ½ô¸úPHPÔÚÔËÐÐʱ·ÖÅä¸ø¸Ã×ÊÔ´µÄ±íʾ´úºÅ£©¡£
PHPÊý¾Ýת»»³ÉboolÐÍ
½á¹ûΪFALSEµÄÊý¾ÝÀàÐÍ£º
nt»òfloatÐÍÊý0
¿Õ×Ö·û´®ºÍ×Ö·û´®0
ûÓÐÈκÎÔªËصĿÕÊý×é
ûÓÐÈκÎÔªËصĶÔÏó
Null
½á¹ûΪTRUEµÄÊý¾ÝÀàÐÍ£º
ÆäËûÇé¿öΪTRUE¡£
×¢Ò⣺ÔÚ²âÊÔת»»³ÉboolÐͺóµÄ½á¹ûʱ²»ÄÜʹÓÃechoºÍprint£¬¿ÉÒÔʹÓÃgettyp
Ïà¹ØÎĵµ£º
<?php
//µ÷ÊÔÊä³öÐÅÏ¢
$pageCount=15;
for($i=1;$i<=$pageCount;$i++){
dump(GetPageRange($i,$pageCount),$i);
}
//$currentPage µ±Ç°Ò³Âë
//$pageCount ×ÜÒ³Êý
//$leftSize ×ó²àÒ³Â뷶Χ
//$rightSize ÓÒ²àÒ³Â뷶Χ
//·µ»ØÒ³ÂëÇø¼äÊý×é
function GetPageRange($currentPage,$pageCount,$leftSize=3, ......
./home/a.php
./b.php
b.php
<?php
setcookie('name[1]',"aaa");
setcookie('name[2]',"bbb");
setcookie('name[3]',"ccc");
?>
ÔÚa.php ÖÐ
&nb ......
1.ÓÃ;:
·þÎñÆ÷¿ÉÒÔÀûÓÃCookies°üº¬ÐÅÏ¢µÄÈÎÒâÐÔÀ´É¸Ñ¡²¢¾³£ÐÔά»¤ÕâЩÐÅÏ¢£¬ÒÔÅжÏÔÚHTTP´«ÊäÖеÄ״̬¡£Cookies×îµäÐ͵ÄÓ¦ÓÃÊÇÅж¨×¢²áÓû§ÊÇ·ñÒѾµÇ¼ÍøÕ¾£¬Óû§¿ÉÄÜ»áµÃµ½Ìáʾ£¬ÊÇ·ñÔÚÏÂÒ»´Î½øÈë´ËÍøվʱ±£ÁôÓû§ÐÅÏ¢ÒÔ±ã¼ò»¯µÇ¼ÊÖÐø£¬ÕâЩ¶¼ÊÇCookiesµÄ¹¦Óá£ÁíÒ»¸öÖØÒ ......
ÑéÖ¤ÂëµÄ´óÖÂÔÀíÊÇÕâÑùµÄ£¬Ê×ÏÈÉú³ÉÒ»¸öËæ»úÊý£¬È»ºóÔÚÊý¾ÝÊýÉÏÃæ¼ÓÉϸÉÈÅͼƬ£¬Í¬Ê±°Ñ¸ÃÊý¾ÝÉú³ÉͼƬ²¢Êä³ö¡£
Õâ¸öÊý¾Ý±£´æÔÚsessionÖС£È»ºó°ÑÓû§µÄÊäÈëÓë±£´æÔÚsessionÖеÄÊý¾Ý½øÐÐÆ¥Å䣬½øÐÐÑéÖ¤¡£
verifyCode.php´úÂëÈçÏ£º
<?php
Header("Content-type: image/PNG");
session_start();
//× ......
Memcacheº¯Êý¿âÊÇÔÚ PECL(PHP Extension Community Library)ÖУ¬Ö÷Òª×÷ÓÃÊǴ´óÈÝÁ¿µÄÄÚ´æÊý¾ÝµÄÁÙʱ´æ·ÅÇøÓò£¬ÔÚ·Ö²¼Ê½µÄʱºò×÷ÓÃÌåÏֵķdz£Ã÷ÏÔ£¬·ñÔò²»½¨ÒéʹÓá£
Memcache Win32 µÄ°²×°ºÍPHPÖеÄÅäÖÃ
ÏÂÔØ£ºMemcache Win32
www.php100.com www.jehiah.cz/projects/memcached-win32/
1¡¢½âѹµ½Ä¿Â¼£º ......