PHP³õѧ֮·ÀË®¼ÆÊýÆ÷
ÕâÊÇÎÒдµÄµÚÒ»¸ö¼ÆÊýÆ÷
<?
$s_ht="127.0.0.1";
$s_user="root";
$s_pas="123456";
$s_data="ceshi";
if (empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$myip = $_SERVER['REMOTE_ADDR'];
$myip = $_SERVER['REMOTE_ADDR'];
}
else {
$myip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$myip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$myip = $myip[0]; $myip = $myip[0];
}
//------Á´½ÓÊý¾Ý¿â----------
$conn=mysql_connect($s_ht,$s_user,$s_pas);
//-----------·ÀÖ¹¶à´ÎË¢ÐÂÅжϣ¬ÏÂÃæÏȽøÐвéѯ-----------------
$sql="select * from `ceshi`.`jishuqi` where ip = '$myip'";
$result=mysql_db_query($s_data,$sql,$conn);
$row=mysql_fetch_row($result);
mysql_free_result($result);
if(!$row)
{
$sql="insert into `ceshi`.`jishuqi` ( `jishu`, `ip`, `time_at` ) values ( '1', '$myip', now() )";
mysql_select_db($s_data,$conn);
$result=mysql_query($sql);
mysql_close($conn);
}
else
{
$sql="select time_to_sec(now()) - time_to_sec(time_at) from jishuqi where ip='$myip' order by time_to_sec(now()) - time_to_sec(time_at) asc";
$result=mysql_db_query($s_data,$sql,$conn);
$row=mysql_fetch_row($result);
mysql_free_result($result);
if($row[0] > 10)
{
$sql="insert into `ceshi`.`jishuqi` ( `jishu`, `ip`, `time_at` ) values ( '1', '$myip', now() )";
mysql_select_db($s_data,$conn);
$result=mysql_query($sql);
}
}
$sql="select count(*) from `ceshi`.`jishuqi`";
$result=mysql_db_query($s_data,$sql,$conn);
$row=mysql_fetch_row($result);
mysql_free_result($result);
$ss="select * from `ceshi`.`jishuqi` order by 3 desc";
$cha=mysql_db_query($s_data,$ss,$conn);
$guo=mysql_fetch_row($cha);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>¼ÆÊýÆ÷</title>
Ïà¹ØÎĵµ£º
(PHP 4 >= 4.0.4)
¹¦ÄÜ˵Ã÷£ºCheck for numeric character(s)
Description
bool ctype_digit ( string text)
Returns TRUE if every character in text is a decimal digit, FALSE otherwise.
Àý×Ó 1. A ctype_digit() example
<?php $strings = array('1820.20', '10002', 'wsl!12'); foreach ($strings ......
1.ÊÇ·ñ¿ÉÒÔÔÚÀàµÄÍⲿ·ÃÎÊÒ»¸öÊôÐÔÊÇÓÉ·ÃÎÊÐÞÊηûÀ´È·¶¨µÄ¡£
2.´ÓÀàµÄÍⲿֱ½Ó·ÃÎÊÀàµÄÊôÐÔÊÇÔã¸âµÄÏë·¨¡£ÃæÏò¶ÔÏóµÄÒ»¸ö·½·¨¾ÍÊǹÄÀø·â×°¡£ÔÚPHPÖУ¬ÎÒÃÇÒ»°ãͨ¹ý__get()Óë__set()º¯ÊýÀ´ÊµÏÖ¶Ô
ÊôÐԵķÃÎÊ.Èç¹û²»Ö±½Ó·ÃÎÊÒ»¸öÀàµÄÊôÐÔ¶øÊDZàд·ÃÎʺ¯Êý£¬ÄÇô¿ÉÒÔͨ¹ýÒ»¶Î´úÂëÖ´ÐÐËùÓзÃÎÊ¡£×î³õµÄ·ÃÎʺ¯ÊýÈçÏÂËùʾ:
cla ......
1.ËùÓеÄÊý¾Ý¶¼Ó¦¸ÃÒþ²ØÔÚËùÔÚµÄÀàµÄÄÚ²¿¡£
2.ÀàµÄʹÓÃÕß±ØÐëÒÀÀµÀàµÄ¹«¹²½Ó¿Ú£¬µ«À಻ÄÜÒÀÀµËûµÄʹÓÃÕß¡£
3.¾¡Á¿¼õÉÙÀàÐÒéÖеÄÏûÏ¢¡£
4.ʵÏÖËùÓÐÀ඼Àí½âµÄ×î»ù±¾µÄ½Ó¿Ú¡££¨¿½±´²Ù×÷£¬°üÀ¨É±´ºÍdz¿½±´£©£¬ÏàµÈÐÔÅжϣ¬ÕýÈ·Êä³öÄÚÈÝ£¬´ÓASC2ÃèÊö½âÎöµÈµÈ¡£
5.²»°ÑʵÏÖϸ½ÚÈç·ÀÖ¹¹«¹²´úÂëµÄ˽Óк¯Êý.·Åµ½ÀàµÄ¹²Óнӿ ......
1.ÀàºÍ¶ÔÏó¡£
ÀàÊÇÒ»ÀàÊÂÎïµÄÃèÊö¡£³éÏ󣬸ÅÄîÉϵĶ¨Òå¡£
¶ÔÏóÊÇʵ¼Ê´æÔÚµÄÿ¸ö¸öÌå¡£Ò²½ÐʵÀý¡£¶ÔÏóÊÇnew³öÀ´µÄ¡£$p = new Person();
2.ÊôÐÔ
ÓÃÀ´ÃèÊöÀàÖеÄÊý¾ÝÔªËØ¡££¨Ò²½ÐÊý¾Ý/״̬£©
ÐÞÊηû£¨PHP5ÖбØÐëÐÞÊΣ©:public(¹«¿ª,ÀàµÄÄÚÍⲿ¶ÁÈ¡ÐÞ¸Ä),private(˽ÓÐÖ»ÔÚµ±Ç°ÀàÖжÁÈ¡ÐÞ¸Ä),protected(±£»¤,ÄÜÔÚÕâ¸öÀàºÍ ......