PHPÀàµÄ·ÃÎÊ¿ØÖÆ
PHPÖÐÀàµÄ·½·¨Ò²ºÍC++ͨ¹ý¹Ø¼ü×Ö private
¡¢Public
¡¢ protected
À´¿ØÖƵġ£Ï±ßÊÇÏêϸ˵Ã÷£º
1¡¢private
º¯ÊýǰʹÓùؼü×ÖPrivate±íʾº¯ÊýÊÇ˽Óеģ¬Ë½ÓеÄÒâ˼¹ËÃû˼Ò壬Õë¶Ôµ±Ç°Àà˽ÓУ¬ÎÞÂÛÊÇËûµÄ×ÓÀ໹ÊÇËûµÄʵÀý¶¼ÎÞ·¨·ÃÎÊ¡£
»¹ÊÇÏÈ¿´´úÂ룺
<?php
class Persion
{
function Persion()
{
echo "Persion OK";
}
private function test1()
{
echo "test1.......";
}
protected function test2()
{
echo "test2.....";
}
public function test3()
{
echo "test3....";
}
}
class Child extends Persion
{
function Child()
{
echo "Child OK".'<br>';
//µ÷Óø¸ÀàµÄ˽Óз½·¨
Persion::test1();
}
}
$c = new Child;
//ʵÀýÖе÷ÓÃ˽Óз½·¨
$c->test1();
?>
ÒÔÉÏ´úÂë×¢ÊͲ¿·ÖµÄµ÷Óö¼»áÒýÆð±¨´í£¬ËùÒÔPrivate±ê¼ÇµÄº¯ÊýÖ»ÄÜÔÚµ±Ç°ÀàÖÐʹÓá£
2¡¢protected
º¯ÊýÓôʹؼü×Ö£¬±íʾ£¬º¯ÊýÊÇÊܱ£»¤µÄ£¬Òâ˼ÊÇÖ¸´Ëº¯ÊýÖ»¿ÉÒÔÔÙµ±Ç°º¯ÊýºÍÆä×ÓÀàÖÐʹÓã¬ÔÚʵÀýÖÐÎÞ·¨µ÷Óá£
´úÂ룺
<?php
class Persion
{
function Persion()
{
echo "Persion OK".'<br>';
//µ±Ç°ÀàÖе÷ÓÃProtected·½·¨
echo self::test2();
}
private function test1()
{
echo "test1.......<br>";
}
protected function test2()
{
echo "test2.....<br>";
}
public function test3()
{
echo "test3....<br>";
}
}
class Child extends Persion
{
function Child()
{
Persion::Persion();
echo "Child OK".'<br>';
//µ÷Óø¸ÀàµÄProtected·½·¨
Persion::test2();
Persion::test4();
}
}
$c = new Child;
//ʵÀýÖе÷ÓÃProtected·½·¨
$c->test2();
?>
ÔËÐдúÂë¿ÉÒÔ¿´µ½£¬ÔÚµ±Ç°ÀàÖе÷ÓúÍ×ÓÀàÖе÷Óö¼Ã»ÓÐÎÊÌ⣬¶øÔÚʵÀýÖе÷ÓÃʱ»á±¨´í¡£
3¡¢public
¹
Ïà¹ØÎĵµ£º
»ù´¡ÎÊÌâ:
×î½ü±»µ¥Ë«ÒýºÅÀ§ÈÅ×Å£¬²»ÖªµÀʲôʱºòÓÃË«ÒýºÅ£¬Ê²Ã´Ê±ºòÓõ¥ÒýºÅ¡£×ܽáÇø·ÖÒ»ÏÂ
Ôڴ󲿷ÝÓïÑÔÖУ¬ÒýºÅÒýÆðÀ´µÄÄÚÈݶ¼±íʾΪ×Ö·û¡£
ÀýÈ磺
<a href="µØÖ·">Á´½Ó</a>
echo "×Ö·û´®";
print("×Ö ......
˵¾äʵ»°,дÕâ¸öÕæ¹»ÎÞÁĵÄ.±¾À´¿´ÁËijλ´óϺµÄÀàËÆÎÄÕÂ,¸¹·ÌÁ˼¸¾äÒ²¾ÍËãÁË.µ«ÊÇ×òÌìÍíÉÏÓиö¿Í»§ÄÃ×ÅÕâƪÎÄÕÂÎÊÎÒ: ÄãѾµÄ×Ô¼º×ö
Íâ°ü,ÄãË㼸¶ÎPHPer?Ëì¸Ð¾õÄÇƪÎÄÕ¶ÔijЩ°ëͨ²»Í¨Ö®È˵ÄÎóµ¼Ö®Éî.ÎÞ·¨,Ö»ÓÐд´ËÎÄÕ±íÃ÷ÎÒ¶ÔPHPerµÄˮƽÇø·ÖµÄÁ¢³¡.
¹ØÓÚ¾ßÌåÊÕÈëˮƽ,×ܵÄÀ´ËµÒòΪÕ⼸ÄêPHPÅàѵ°àµÄ¼Ó¶à,´óÁ¿PHPÐÂÊÖ¿ ......
<?php
/**
* ʹÓù²ÏíÄÚ´æµÄPHPÑ»·ÄÚ´æ¶ÓÁÐʵÏÖ
* Ö§³Ö¶à½ø³Ì, Ö§³Ö¸÷ÖÖÊý¾ÝÀàÐ͵Ĵ洢
* ×¢: Íê³ÉÈë¶Ó»ò³ö¶Ó²Ù×÷,¾¡¿ìʹÓÃunset(), ÒÔÊÍ·ÅÁÙ½çÇø
*
* @author wangbinandi@gmail.com
* @created 2009-12-23
*/
class SHMQueue
{
private $maxQSize = 0; // ¶ÓÁÐ×î´ó³¤¶È
private $front = 0; ......
ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÈË: wesley (ÐÄÖеÄÉÁÖ), ÐÅÇø: Java
±ê Ìâ: ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÕ¾: ˮľÉçÇø (Thu Dec 24 01:55:04 2009), Õ¾ÄÚ
תÔØ×Ô±¾ÈËÐÂÀ˲©¿Í
http://blog.sina.com.cn/s/blog_53923f940100g7xx.html
£¨ÀÏÎâ×ÔÑÔ×ÔÓ
×î½üƵ·±ÌýË ......
ÕªÒª: ÓÃÕýÔòʵÏÖ°üº¬Ä³¸ö×Ö·û´®ºÜÈÝÒ×£¬µ«Èç¹ûʵÏÖ²»°üº¬Ä³¸ö×Ö·û´®ÄØ£¿×÷Õ߸ø³öÁËÒ»¸ö½â¾ö·½°¸¡£
ÅжÏÒ»¸ö×Ö·û´®ÖÐÊÇ·ñº¬ÓÐÁíÒ»×Ö·û´®£¬phpÓкܶ෽·¨£¬ÈçÏ£º
1. ³£¼ûº¯Êý
strstr($str, "abc");
strstr($str, "abc");
2. ÕýÔòÆ¥Åä
preg_match("/(abc)/is", $str);
p ......