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

PHP¼òµ¥¼ÆÊýÆ÷

 <?php
/*ʹÓÃÎı¾Îļþ¼Ç¼Êý¾ÝµÄ¼òµ¥ÊµÏÖ*/
$counter=1;
if(file_exists("mycounter.txt")){
$fp=fopen("mycounter.txt","r");
$counter=fgets($fp,9);
$counter++;
fclose($fp);
}
$fp=fopen("mycounter.txt","w");
fputs($fp,$counter);
fclose($fp);
echo "<h1>ÄúÊǵÚ".$counter."´Î·ÃÎʱ¾Ò³Ã棡<h1>";
?>
<?php
//ÏÂÃæÕâ¸öΪʹÓûùÓÚÊý¾Ý¿âµÄ¼òµ¥¼ÆÊýÆ÷£¬Î´Ìí¼ÓÆäËû·ÀÖ¹Ò»ÈËÖØ¸´Ë¢Ðµķ½·¨¡£½ö¹©²Î¿¼¡£¡£
$conn=mysql_connect("localhost","root","abc");
$result=mysql_query("use db_counter");
$re=mysql_query("select * from tb_counter");
$result=mysql_fetch_row($re);
$counter=$result[0];
echo "ÄúÊǵÚ{$counter}λ·ÃÎÊÕߣ¡";
$counter+=1;echo "<hr>{$counter}";
mysql_query("update tb_counter set counter=$counter");
mysql_close($conn);
?>


Ïà¹ØÎĵµ£º

PHPÃæÊÔÌ⣨¸½´ð°¸£©

1.ÔÚPHPÖУ¬µ±Ç°½Å±¾µÄÃû³Æ£¨²»°üÀ¨Â·¾¶ºÍ²éѯ×Ö·û´®£©¼Ç¼ÔÚÔ¤¶¨Òå±äÁ¿£¨1£©ÖУ»¶øÁ´½Óµ½µ±Ç°Ò³ÃæµÄµÄÇ°Ò»Ò³ÃæURL¼Ç¼ÔÚÔ¤¶¨Òå±äÁ¿£¨2£©ÖР
<?php
//±¾Ò³µØÖ·£¬SCRIPT_NAMEÒ²¿ÉÒÔ
echo $_SERVER['PHP_SELF']."<br />";
//Á´½Óµ½µ±Ç°Ò³ÃæµÄÇ°Ò»Ò³ÃæµÄ URL µØÖ·:
echo $_SERVER ......

ÆóÒµPHPÃæÊÔÌâ»ã×Ü

1¡¢ÓÃPHP´òÓ¡³öǰһÌìµÄʱ¼ä¸ñʽÊÇ2006-5-10 22:21:21(2·Ö)
¡¡¡¡2¡¢echo(),print(),print_r()µÄÇø±ð(3·Ö)
¡¡¡¡3¡¢Äܹ»Ê¹HTMLºÍPHP·ÖÀ뿪ʹÓõÄÄ£°å(1·Ö)
¡¡¡¡4¡¢Ê¹ÓÃÄÄЩ¹¤¾ß½øÐа汾¿ØÖÆ?(1·Ö)
¡¡¡¡5¡¢ÈçºÎʵÏÖ×Ö·û´®·­×ª?(3·Ö)
¡¡¡¡———————————& ......

Ïêϸ½âÊÍPHPÖÐheaderºÍcontent


void header ( string string [, bool replace [, int http_response_code]] )
void header ( string string [, bool replace [, int http_response_code]] )
header()ÊÇÓÃÀ´·¢ËÍ HTTP HeaderµÄ¡£replaceÊǸö¿ÉÑ¡µÄ²ÎÊý£¬Ö¸Ê¾ÊÇ·ñÌæ´úÒ»¸öÏÈÆÚÏàËÆµÄheader£¬
......

PHP ¾Å¾Å³Ë·¨±í

¿ÉÒÔ¼òµ¥µÄÓÐÁ½¸öforÑ­»·±íʾ ¾Å¾Å³Ë·¨±í,µ«ÊDz¢²»ÖªµÀÈçºÎ½øÐÐURLµÄÉèÖÃ.
<?php
for($a =1;$a<=9;$a++)
{
  for($b =1;$b<=$a;$b++)
  {$c =$a *$b;
    echo "$a*$b=$c  ";
  }
    echo "<p>";
}
?> ......

phpѧϰ±Ê¼Ç

 1¡¢$_SERVER['SCRIPT_NAME']¡¢$_SERVER['PHP_SELF']ºÍ$_SERVER['REQUEST_URI']Çø±ð
Àý×Ó:http://localhost/phpwind75/test.php/%22%3E%3Cscript%3Ealert(’xss’)%3C/script%3E%3Cfoo
$_SERVER['SCRIPT_NAME']Ö»»ñÈ¡½Å±¾Ãû£¬²»»ñÈ¡²ÎÊý,Êä³ö½á¹ûΪ:test.php;
$_SERVER['PHP_SELF']»ñÈ¡½Å±¾Ãûºó£¬Í¬Ê±»ñÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ