PHPÑéÖ¤ÂëÉú³É½Å±¾£¨5λÊý×Öpng¸ñʽ£©
<?php
header("Content-Type:image/png");
srand((double)microtime()*1000000);
$img_height=20;
$img_width=60;
$im=@imagecreate($img_width,$img_height) or die("²»Äܳõʼ»¯GDÎļþÁ÷");
$background_color=imagecolorallocate($im,255,255,255);
$text_color=imagecolorallocate($im,233,14,91);
//»æÖƸÉÈÅÑ©»¨
for($i=1;$i<=100;$i++)
{
imagestring($im,1,mt_rand(1,$img_width),mt_rand(1,$img_height),"*",imageColorAllocate($im,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255)));
}
while(($num=rand()%100000)<10000);
//½«Ëæ¼´²úÉúµÄÑéÖ¤Âë±£´æÔÚsessionÖУ¬·½±ãÒÔºóʹÓÃ
//session_start();
$_SESSION["num"]=null;//ÑéÖ¤ÂëË¢ÐÂ
$_SESSION["num"]=$num;
//»æÖÆ×Ö·û´Óµ½Í¼Ïñ
imagestring($im,4,15,2,$num,$text_color);
imagepng($im);
imagedestroy($im);
?>
Ïà¹ØÎĵµ£º
Ò»£¬PHP½Å±¾´úÂë±ê¼Ç
PHPµÄ½Å±¾ÊÇÎļþÖÐÒ»¶ÔÌØÊâ±ê¼ÇËù°üÀ¨µÄÄÚÈÝ£¬ÈçASPÊÇ“<%....%>”,PHP¿É¿´³ÉÊÇ“<?...?>”¡£
È»¶øΪÁËÊÊÓ¦XML±ê×¼ÒÔ½«PHPǶÈëµ½XML»òXHTMLÖУ¬PHP²»½¨ÒéʹÓö̸ñʽµÄ“<?...?>”£¬¶ø½¨ÒéʹÓó¤¸ñʽ±ê¼Ç“<?php...?>”
´ËÍâPHP´úÂ ......
iconvº¯Êý¿âÄܹ»Íê³É¸÷ÖÖ×Ö·û¼¯¼äµÄת»»£¬ÊÇphp±à³ÌÖв»¿ÉȱÉٵĻù´¡º¯Êý¿â¡£
1¡¢ÏÂÔØlibiconvº¯Êý¿âhttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz£»
2¡¢½âѹËõtar -zxvf libiconv-1.9.2.tar.gz;
3¡¢°²×°libiconv
££configure --prefix=/usr/local/iconv
#make
......
1£ºint strposº¯ÊýµÄ×÷ÓúÍCÓïÑÔÖеÄchar *strstr()Ò»Ñù
2£ºhtmlspecialchars()£¬½«ÌØÊâ×Ö·ûת»¯ÎªHTMLʵÌå(entity)
3£ºPHPÖ÷ÒªÓÃÓÚÒÔÏÂÈý¸öÁìÓò£º
1>£º·þÎñÆ÷¶Ë½Å±¾ 2>£ºÃüÁîÐнű¾ 3>£º±àд×ÀÃæÓ¦ÓóÌÐò
4£ºphp²¢ÖÃÔËËã·û(.)½«Á½¸ö×Ö·û´®Á¬½ÓÆðÀ´
5£ºphpµÄ×¢ÊͺÍCÓïÑÔµÄ×¢ÊÍÒ»Ñù¡ ......
PHPµÄÊý¾ÝÀàÐ͵Äת»»ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ°ìµ½£ºÖ±½ÓÊäÈëÄ¿±êµÄÊý¾ÝÀàÐͺÍͨ¹ýsettypeº¯ÊýʵÏÖ¡£
PHPÊý¾Ýת»»³ÉÕûÊý
FloatÐÍÊý¾Ýת»»³ÉintÐÍ
FloatÐÍת»»³ÉintÐÍ£¬Ð¡ÊýµãºóµÄÊý½«±»ÉáÆú¡£Èç¹ûfloatÊý³¬¹ó³¬¹ýÁËÕûÐ͵ÄÈ¡Öµ·¶Î§£¬ÄÇô½á¹û¿ÉÄÜÊÇ0»òÕßÊÇÕûÐεÄ×îС¸ºÊý¡£
ÀýÈ磺
<?php
$php = 1.59;
echo (int)$php.&rdquo ......
1. $_GET
£º
http://localhost/a.php?a=ok
<?
echo
$_GET['a']; //ÏÔʾ"ok"
?>
2. $_SERVER['QUERY_STRING']
http://localhost/a.php?a=1&b=2&c=3
......