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

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: How to Get the Current Page URL

Sometimes, you might want to get the current page URL that is shown
in the browser URL window. For example if you want to let your visitors
submit a blog post to Digg you need to get that same exact URL. There
are plenty of other reasons as well. Here is how you can do that.
Add the followin ......

¹úÍâÊ®´ó×îÁ÷ÐÐPHP¿ò¼ÜÅÅÃû X


±¾ÎÄÀ´×Ô¹úÍâµÄÒ»¸öPHP¼¼ÊõÈËÔ±ÍøÕ¾£¬×ܽáÁ˹úÍâµÄÊ®¸öĿǰ×îÁ÷ÐеÄPHP
MVC¿ò¼Ü¡£¾ßÌåÅÅÃû˳Ðòδ±Ø×¼È·£¬»¹ÓÐЩ֪Ãû¿ò¼Ü£¬ÈçKohanaµÈҲûÓÐÌá¼°¡£²»¹ýÈÔ¿ÉÒÔ×öΪһƪ²»´íµÄ²Î¿¼¡£
ÒÔÏÂΪʮ¸öĿǰ×îÁ÷ÐеĻùÓÚMVCÉè¼ÆÄ£Ê½µÄPHP¿ò¼Ü¡£
1. Yii
YiiÊÇÒ»¸ö»ùÓÚ×é¼þµÄ¸ßÐÔÄܵÄPHPµÄ¿ò¼Ü£¬ÓÃÓÚ¿ª·¢´ó¹æÄ£WebÓ¦Óá£Yii²ÉÓÃÑ ......

PHP ÖÐ global ±äÁ¿Ó÷¨

¡¡¡¡PHPÖеıäÁ¿Ò²ÓзÃÎÊÓò¡£×÷ÓÃÓò¿ÉÒÔʹÓÃPHPÖÐglobal
¡¡¡¡ÔÚº¯ÊýÄÚ²¿¡¢¶ÔÏóÖкÍÀàÖж¨ÒåµÄ¾Ö²¿±äÁ¿ÔÚº¯ÊýÍⲿÊÇÎÞ·¨±»·ÃÎʵ½µÄ£»Í¬Àí£¬ÔÚº¯ÊýÍⲿ¡¢¶ÔÏóÍâºÍÀàÍⶨÒåµÄ±äÁ¿£¬Èç¹ûûÓб»´«È룬ҲÊÇÎÞ·¨±»·ÃÎʵ½µÄ¡£
¡¡¡¡µ«ÊÇÈç¹ûÒ»¸öºÜ¶à±äÁ¿ÒªÍ¬Ê±±»´«ÈëºÜ¶àº¯Êý¡¢¶ÔÏó»òÕßÀ࣬ÎÒÃÇÒ²¿ÉÒÔÖ±½Ó½«ÆäÈ«¾Ö»¯¡£ÕâÑù²»½ö¿ÉÒÔ ......

PHP ÖÐÅжϡ¢Ñ­»·µÄ¼¸ÖÖд·¨

ÏÂÃæ½éÉܼ¸ÖÖPHPÖÐÅжϡ¢Ñ­»·µÄ¼¸ÖÖд·¨¡£
×îÆÕͨµÄÅжϣº
<?php
if( $args != NULL )
{
call_func($args);
}
?>
¶ÔÓÚµ¥ÐеÄÖ´ÐÐÓï¾ä£¬¿ÉÒÔд³É£º
<?php
if( $args != NULL ) call_func($args);
?>
Ò²¿ÉÒÔʹÓÃÒýºÅµÄ·½Ê½¡£
<?php
if( $args != NULL ):
call_func($args); ......

PHP Öг¤Á¬½ÓµÄʵÏÖ

¡¡¡¡Ã¿´ÎÎÒÃÇ·ÃÎÊ PHP ½Å±¾µÄʱºò£¬¶¼Êǵ±ËùÓеÄPHP½Å±¾Ö´ÐÐÍê³Éºó£¬ÎÒÃDzŵõ½·µ»Ø½á¹û¡£Èç¹ûÎÒÃÇÐèÒªÒ»¸ö½Å±¾³ÖÐøµÄÔËÐУ¬ÄÇôÎÒÃǾÍҪͨ¹ý PHP ³¤Á¬½ÓµÄ·½Ê½£¬À´´ïµ½ÔËÐÐÄ¿µÄ¡£
¡¡¡¡Ã¿¸ö PHP ½Å±¾¶¼ÏÞÖÆÁËÖ´ÐÐʱ¼ä£¬ËùÒÔÎÒÃÇÐèҪͨ¹ý set_time_limit À´ÉèÖÃÒ»¸ö½Å±¾µÄÖ´ÐÐʱ¼äΪÎÞÏÞ³¤£»È»ºóʹÓà flush() ºÍ ob_flush() ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ