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

PHPÂëÅ©½ø»¯Ê·2

1.ÊÇ·ñ¿ÉÒÔÔÚÀàµÄÍⲿ·ÃÎÊÒ»¸öÊôÐÔÊÇÓÉ·ÃÎÊÐÞÊηûÀ´È·¶¨µÄ¡£
2.´ÓÀàµÄÍⲿֱ½Ó·ÃÎÊÀàµÄÊôÐÔÊÇÔã¸âµÄÏë·¨¡£ÃæÏò¶ÔÏóµÄÒ»¸ö·½·¨¾ÍÊǹÄÀø·â×°¡£ÔÚPHPÖУ¬ÎÒÃÇÒ»°ãͨ¹ý__get()Óë__set()º¯ÊýÀ´ÊµÏÖ¶Ô
ÊôÐԵķÃÎÊ.Èç¹û²»Ö±½Ó·ÃÎÊÒ»¸öÀàµÄÊôÐÔ¶øÊDZàд·ÃÎʺ¯Êý£¬ÄÇô¿ÉÒÔͨ¹ýÒ»¶Î´úÂëÖ´ÐÐËùÓзÃÎÊ¡£×î³õµÄ·ÃÎʺ¯ÊýÈçÏÂËùʾ:
class classname {
    public $attribute;
    function __get($name) {
        return $this->$name;
    }
    function __set($name, $value){
        $this->$name = $value;
   }
}
3.´Ë·ÃÎÊÆ÷º¯ÊýµÄÔ­Àí¾ÍÊÇÕâÑù£ºÖ»Ê¹ÓÃÒ»¶Î´úÂëÀ´·ÃÎÊÌض¨ÊôÐÔ¡£ÓÉÓÚÖ»ÓÐÒ»¸öÈë¿Ú£¬¾Í¿ÉÒÔ¶ÔÒª±£´æµÄÊý¾Ý½øÐмì²é£¬¿ÉÒÔÈ·±£±£´æµÄÊý
¾ÝÊÇÓÐÒâÒåµÄÊý¾Ý¡£ÀýÈç:
function _set ($name, $value) {
    if( ($name == "attribute") && ($value >= 0) && ($value <= 100) ) {
        $this->attribute = $value;
    }
}
4.ͨ¹ýµ¥Ò»µÄ·ÃÎÊÈë¿Ú£¬¿ÉÒÔ·½±ãµØ¸Ä±äDZÔڵijÌÐòʵÏÖ¡£Èç¹ûÓÉÓÚijÖÖÔ­Òò£¬ÐèÒª¸Ä±äÊôÐÔ$attributeµÄ±£´æ·½Ê½£¬·ÃÎÊÆ÷º¯ÊýÔÊÐíÎÒÃÇÖ»
ÒªÐÞ¸ÄÒ»´¦´úÂ룬¾Í¿ÉÒÔÍê³É´Ë¹¤×÷¡£
5.__get(),__set(),__isset(),__unset().
Ò»°ãÀ´Ëµ£¬×ÜÊÇ°ÑÀàµÄÊôÐÔ¶¨ÒåΪprivate,ÕâÑù¸ü¸´ºÏÏÖʵÂß¼­¡£
__get(),__set():ÓÃÀ´»ñÈ¡ºÍ¸³ÖµÆäÊôÐÔ.ËûÃDz»ÊÇĬÈÏ´æÔÚµÄ,¶øÊÇÎÒÃÇÊÖ¹¤Ìí¼Ó½øÈ¥µÄ¡£
__isset(),__unset():À´¼ì²éÊôÐÔºÍɾ³ýÊôÐÔ¡£
6.__get()Óë__set(),__isset()Óë__unset()µÄÒ»°ãÌí¼Ó·½·¨¡£
//__get()·½·¨ÓÃÀ´»ñȡ˽ÓÐÊôÐÔ.
private function __get($property_name) {
    if (isset($this -> property_name)) {
        return($this -> $property_name);
    } else {
        return(NULL);
    }
}
//__set()·½·¨ÉèÖÃ˽ÓÐÊôÐÔ
private function __set($property_name,$value) {
    $this -> $property_name = $value;
}
//__isset()·½·¨¿ÉÒÔÉèΪ˽ÓÐ
private function __isset($property_name) {


Ïà¹ØÎĵµ£º

JS ºÍPHP Êý¾Ý¿â²Ù×÷ÔÚÒ»¸öÒ³Ãæ

  <?   
  require   ("config.php3");   
  ?>   
  <?   
  if($submit)   
  {   
  //echo   $action;   
    
  //if($action=='update')  &nb ......

phpËæ»úÊýrand(),mt_rand()¼ò˵

phpÉú³ÉËæ»úµÄº¯ÊýÓÐrand()£¬mt_rand()¡£ÕâÁ©º¯Êý¶ÔÓ¦µÄÖÖ×Óº¯Êýsrand(),mt_srand()¡£
ÔÚphp 4.2.0֮ǰÔÚµ÷ÓÃËæ»úº¯Êý֮ǰµÃÏÈÉèÖÃÖÖ×Óº¯Êý£¬²»È»Éú³ÉµÄÊý¶¼ÊÇΨһµÄ¡£
È磺
4.2.0°æ±¾Ö®Ç°£º
<?
srand((double)microtime()*1000000); //²úÉúËæ»úÖÖ×Óseed
$randval = rand(0,100); //ÔÚ0ºÍ100Ö®¼äÈ¡Ò»¸ ......

ÔÚPHPÀïµÃµ½Ç°ÌìºÍ×òÌìµÄÈÕÆڵĴúÂë

ÔÚPHPÀïµÃµ½Ç°ÌìºÍ×òÌìµÄÈÕÆڵĴúÂëÇ°ÌìÈ¥ÃæÊÔµÄʱºòÒ²ÊÇÕâÑù,²»¹ýÎÒµ±Ê±¼Ç²»ÆðÀ´ÁË.¾Í¼ÇµÃMYSQLÀïÃæµÄdate_sub(now(),'interval 1 day');date('Y/m/d h:i:s',mktime(date('h'), date('i'), date('s'), date('m') , date('d')+1, date('Y'))); -------------------------------------------------------------------------- ......

PHPÈçºÎÓëJS½øÐн»»¥£¿

½ñÌìÓÖͻȻ·¢ÏÖÁËÒ»¸ö¼¼ÇÉ£¬¾ÍÊÇPHP¿ÉÒÔ´«Öµ¸øjs£¬ÈçºÎ×öÄØ£¿
Ô­À´PHPµÄÔ­ÀíÊÇÕâÑùµÄ£º
PHPµÄËùÓÐÓ¦ÓóÌÐò¶¼ÊÇͨ¹ýWEB·þÎñÆ÷(ÈçIIS»òApache)ºÍPHPÒýÇæ³ÌÐò½âÊÍÖ´ÐÐÍê³ÉµÄ£¬¹¤×÷¹ý³Ì£º
(1)µ±Óû§ÔÚä¯ÀÀÆ÷µØÖ·ÖÐÊäÈëÒª·ÃÎʵÄPHPÒ³ÃæÎļþÃû£¬È»ºó»Ø³µ¾Í»á´¥·¢Õâ¸öPHPÇëÇ󣬲¢½«ÇëÇó´«ËÍ»¯Ö§³ÖPHPµÄWEB·þÎñÆ÷¡£
(2)WEB·þÎñÆ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ