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

PHPÀàʵÀý½Ì³Ì£¨Ê®Î壩£ºfinalÀà¡¢final·½·¨ºÍ³£Á¿

final---ÓÃÓÚÀà¡¢·½·¨Ç°¡£
finalÀà---²»¿É±»¼Ì³Ð¡£
final·½·¨---²»¿É±»¸²¸Ç¡£
finalÀ಻Äܱ»¼Ì³Ð¡£
Èç¹ûÎÒÃDz»Ï£ÍûÒ»¸öÀà±»¼Ì³Ð£¬ÎÒÃÇʹÓÃfinalÀ´ÐÞÊÎÕâ¸öÀà¡£
ÓÚÊÇÕâ¸öÀཫÎÞ·¨±»¼Ì³Ð¡£
±ÈÈçÎÒÃÇÉ趨µÄMathÀà£¬Éæ¼°ÁËÎÒÃÇÒª×öµÄÊýѧ¼ÆËã·½·¨£¬ÕâЩË㷨ҲûÓбØÒªÐ޸ģ¬Ò²Ã»ÓбØÒª±»¼Ì³Ð£¬ÎÒÃǰÑËüÉèÖóÉfinalÀàÐÍ¡£
<?php
//ÉùÃ÷Ò»¸öfinalÀàMath
final class Math
{
public static $pi = 3.14;
public function __toString() {
return "ÕâÊÇMathÀà¡£";
}
}
$math = new Math();
echo $math;
//ÉùÃ÷ÀàSuperMath ¼Ì³Ð×Ô MathÀà
class SuperMath extends Math
{
}
//Ö´Ðлá³ö´í£¬finalÀ಻Äܱ»¼Ì³Ð¡£
?>
final·½·¨²»Äܱ»ÖØÐ´
Èç¹û²»Ï£ÍûÀàÖеÄij¸ö·½·¨±»×ÓÀàÖØÐ´£¬ÎÒÃÇ¿ÉÒÔÉèÖÃÕâ¸ö·½·¨Îªfinal·½·¨£¬Ö»ÐèÒªÔÚÕâ¸ö·½·¨Ç°¼ÓÉÏfinalÐÞÊηû¡£Èç¹ûÕâ¸ö·½·¨±»×ÓÀàÖØÐ´£¬½«»á³öÏÖ´íÎó¡£
<?php
//ÉùÃ÷Ò»¸öfinalÀàMath
class Math
{
public static $pi = 3.14;
public function __toString() {
return "ÕâÊÇMathÀà¡£";
}
public final function max($a, $b)
return $a > $b ? $a : $b ;
}
}
//ÉùÃ÷ÀàSuperMath ¼Ì³Ð×Ô MathÀà
class SuperMath extends Math
{
public final function max($a, $b) {
}
}
//Ö´Ðлá³ö´í£¬final·½·¨²»Äܱ»ÖØÐ´¡£
?>


Ïà¹ØÎĵµ£º

¡¾PHP¡¿Ñ¡ÔñÌâÌâ¿âϵͳV1.0

Õâ¸öϵͳÆäʵÊÇÁ·Ï°php»ù±¾Óï·¨ºÍMySQLµÄ»ù±¾²éѯÓï¾ä¡£¸øÒ»ÆðѧϰµÄÅóÓÑ·ÖÏí¡£ ^_^
ÔÚphpÎļþÖУ¬Ë«Ð±¸ÜºóÃæÊÇ×¢ÊÍÓï¾ä£¬ÎÒÓÃÓ¢ÎÄдµÄ×¢ÊÍ¡£
Õû¸öϵͳËù°üº¬µÄ.htmºÍ.phpÎļþÓУº
add_que.htm——Ìí¼ÓÐÂÌâµÄÒ³Ãæ
insert.php——ÏÔʾÌí¼ÓÐÂÌâÐÅÏ¢µÄÒ³Ãæ
questionlist.php——ËùÓÐÎÊÌâÁÐ ......

PHPÖеÄʵÏÖRegistryģʽ¹ý³ÌÖеÄÁìÎò

<?php
/*
Singleton && Registry Design Pattern Implementation
*/
class Registry {
private $_store = array();
public function getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] = new ......

PHPÀàʵÀý½Ì³Ì£¨Æß£©£ºÎö¹¹º¯ÊýÓëPHPµÄÀ¬»ø»ØÊÕ

Îö¹¹º¯Êý£ºµ±Ä³¸ö¶ÔÏó³ÉΪÀ¬»ø»òÕßµ±¶ÔÏó±»ÏÔʽÏú»ÙʱִÐС£
GC(Garbage Collector)
ÔÚPHPÖУ¬Ã»ÓÐÈκαäÁ¿Ö¸ÏòÕâ¸ö¶ÔÏóʱ£¬Õâ¸ö¶ÔÏó¾Í³ÉΪÀ¬»ø¡£PHP»á½«ÆäÔÚÄÚ´æÖÐÏú»Ù¡£ÕâÊÇPHPµÄGC(Garbage Collector)À¬»ø´¦Àí»úÖÆ£¬·ÀÖ¹ÄÚ´æÒç³ö¡£µ±Ò»¸öPHPÏ߳̽áÊøÊ±£¬µ±Ç°Õ¼ÓõÄËùÓÐÄÚ´æ¿Õ¼ä¶¼»á±»Ïú»Ù£¬µ±Ç°³ÌÐòÖеÄËùÓжÔÏóͬÑù± ......

PHPÒ³ÃæÖØ¶¨Ïò£¡

Ò³ÃæµÄÖØ¶¨Ïò£¬ËãÊǺܳ£ÓõŦÄÜÁË¡£ÏÂÃæÕªÂ¼³£ÓõÄ3ÖÖ·½·¨£º
<?php
¡¡¡¡if (isset($url))
¡¡¡¡{
¡¡¡¡Header("HTTP/1.1 303 See Other");
¡¡¡¡Header("Location: $url");
¡¡¡¡exit; //from www.kjsc.com.cn
¡¡¡¡}
¡¡¡¡?>
      ¡¡¡¡×¢Òâһϣ¬"Localtion:"ºóÃæÓÐÒ»¸ö¿Õ¸ñ¡£
¡¡¡¡¶ ......

PHPÀàʵÀý½Ì³Ì£¨Ê®¶þ£©£ºÀàÖÐparent::¹Ø¼ü×Ö

PHP5ÖÐʹÓÃparent::À´ÒýÓø¸ÀàµÄ·½·¨¡£ parent:: ¿ÉÓÃÓÚµ÷Óø¸ÀàÖж¨ÒåµÄ³ÉÔ±·½·¨¡£parent::µÄ×·Ëݲ»½öÓÚÖ±½Ó¸¸Àà¡£
ͨ¹ýparent::µ÷Óø¸Àà·½·¨
<!-- ÉùÃ÷Ò»¸öÔ±¹¤Àà,¾­ÀíÀà¼Ì³Ð×ÔÔ±¹¤Àà -->
<?php
class employee
{
protected $sal = 3000;
public function getSal() {
$this->sal = $this-> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ