¼¸¸öʵÓñãÀûµÄPHP´úÂë
1. PHP¿ÉÔĶÁËæ»ú×Ö·û´®
´Ë´úÂ뽫´´½¨Ò»¸ö¿ÉÔĶÁµÄ×Ö·û´®£¬Ê¹Æä¸ü½Ó½ü´ÊµäÖеĵ¥´Ê£¬ÊµÓÃÇÒ¾ßÓÐÃÜÂëÑéÖ¤¹¦ÄÜ¡£
/**************
*@length - length of random string (must be a multiple of 2)
**************/
function readable_random_string($length = 6){
$conso=array("b","c","d","f","g","h","j","k","l",
"m","n","p","r","s","t","v","w","x","y","z");
$vocal=array("a","e","i","o","u");
$password="";
srand ((double)microtime()*1000000);
$max = $length/2;
for($i=1; $i<=$max; $i++){
$password.=$conso[rand(0,19)];
$password.=$vocal[rand(0,4)];
}
return $password;
}
2. PHPÉú³ÉÒ»¸öËæ»ú×Ö·û´®
Èç¹û²»ÐèÒª¿ÉÔĶÁµÄ×Ö·û´®£¬Ê¹Óô˺¯ÊýÌæ´ú£¬¼´¿É´´½¨Ò»¸öËæ»ú×Ö·û´®£¬×÷ΪÓû§µÄËæ»úÃÜÂëµÈ¡£
/*************
*@l - length of random string
*/
function generate_rand($l){
$c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
for($i=0; $i<$l; $i++) {
$rand.= $c[rand()%strlen($c)];
}
return $rand;
}
3. PHP±àÂëµç×ÓÓʼþµØÖ·
ʹÓô˴úÂ룬¿ÉÒÔ½«Èκεç×ÓÓʼþµØÖ·±àÂëΪ html ×Ö·ûʵÌ壬ÒÔ·ÀÖ¹±»À¬»øÓʼþ³ÌÐòÊÕ¼¯¡£
function encode_email($email='info@domain.com', $linkText='Contact Us', $attrs ='class="emailencoder"' )
{
// remplazar aroba y puntos
$email = str_replace('@', '@', $email);
$email = str_replace('.', '.', $email);
$email = str_split($email, 5);
$linkText = str_replace('@', '@', $linkText);
$linkText = str_replace('.', '.', $linkText);
$linkText = str_split($linkText, 5);
$part1 = '<a href="ma';
$part2 = 'ilto:';
$part3 = '" mce_href="ma';
$part2 = 'ilto:';
$part3 = '" '. $attrs .' >';
$part4 = '</a>';
$encoded = '<mce:script type="text
Ïà¹ØÎĵµ£º
¹úÍâÔ½À´Ô½¶àµÄ¹«Ë¾¿ª·¢FacebookÓ¦Óã¬ÖÁÓÚ¹úÄÚÔÝÇÒ²»±í£¬´ó¼ÒÐÄÖª¶ÇÃ÷¡£»¹ºÃHKÒ²ËãÊÇÌ쳯ϽÇø£¬±¾ßÖÐÒ²Ëã´øÓаëÏ´¾ß……¿ª·¢Á˼¸¿îFacebookÓ¦Óã¬×ܽá¾Ñé½Ìѵ£¬ÔÚÒµÓàʱ¼ä¿ª·¢ÁËÒ»¿îFacebookÓ¦ÓÃPHP¿ª·¢¿ò¼Ü——Fabos¡£
Ϊɶ½ÐFabos£¿ÎÒÓÐÒ»¸öfabosÓòÃû£¬±»ºÍг£¡¾ÍËã×ö¸ö¼ÍÄҲµ±×öÊÇÒµÓàʱ¼ä ......
phpÒýÓÃ(&)Ïê½â
2009-05-13 14:30
phpµÄÒýÓ㨾ÍÊÇÔÚ±äÁ¿»òÕߺ¯Êý¡¢¶ÔÏóµÈÇ°Ãæ¼ÓÉÏ&·ûºÅ£©
ÔÚPHP ÖÐÒýÓõÄÒâ˼ÊÇ£º²»Í¬µÄÃû×Ö·ÃÎÊͬһ¸ö±äÁ¿ÄÚÈÝ.
Óë£ÃÓïÑÔÖеÄÖ¸ÕëÊÇÓвî±ðµÄ£®£ÃÓïÑÔÖеÄÖ¸ÕëÀïÃæ´æ´¢µÄÊDZäÁ¿µÄÄÚÈÝÔÚÄÚ´æÖдæ·ÅµÄµØÖ·
±äÁ¿µÄÒýÓÃ
PHP µÄÒýÓÃÔÊÐíÄãÓ ......
1 ¿ªÊ¼Ð´PHP³ÌÐò
¸úѧC/C++¡¢javaÒ»Ñù£¬ÎÒÃÇÏÈ´Óhello world¿ªÊ¼£º
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚhtmlÎĵµÖеÄÈκÎλÖᣵ±È»£¬ÔÚÖ§³Ö¼òдµÄ·þÎñÆ÷ÉÏ£¬Äú¿ÉÒÔʹÓà <? ºÍ ?> À´¿ªÊ¼ºÍ½áÊø½Å±¾¿é¡£²»¹ý£¬ÎªÁË´ïµ½×îºÃµÄ¼æÈÝÐÔ£¬ÎÒÃÇÍƼöÄúʹÓñê×¼ÐÎʽ£¨ <?php£© £¬¶ ......
Ñ»·Óï¾ä
ÔÚÄú±àд´úÂëʱ£¬Äú¾³£ÐèÒªÈÃÏàͬµÄ´úÂë¿éÔËÐкܶà´Î¡£Äú¿ÉÒÔÔÚ´úÂëÖÐʹÓÃÑ»·Óï¾äÀ´Íê³ÉÕâ¸öÈÎÎñ¡£
ÔÚ PHP ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÁÐÑ»·Óï¾ä£º
while
Ö»ÒªÖ¸¶¨µÄÌõ¼þ³ÉÁ¢£¬ÔòÑ»·Ö´ÐдúÂë¿é
do...while
Ê×ÏÈÖ´ÐÐÒ»´Î´úÂë¿é£¬È»ºóÔÚÖ¸¶¨µÄÌõ¼þ³ÉÁ¢Ê±Öظ´Õâ¸öÑ»·
for
Ñ»·Ö´ÐдúÂë¿éÖ¸¶¨µÄ´ÎÊý
foreach
¸ù ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/02/01/1-8/
PHP²»Ìṩ¿ç½Å±¾µÄÈ«¾Ö±äÁ¿£¬µ«ÊÇ£¬ÒòΪʵ¼ÊµÄÐèÒª£¬PHPÌṩÁËһЩÌØÊâµÄÈ«¾Ö±äÁ¿ÓÃÀ´ÊµÏÖÕâЩ²Ù×÷¡£
$_GET[]£º½ÓÊÕÀ´×ÔÓû§ä¯ÀÀÆ÷ʹÓÃGET·½·¨·¢Ë͵ıäÁ¿µÄÊý×é
$_POST[]£º½ÓÊÕÀ´×ÔÓû§ä¯ÀÀÆ÷ʹÓÃPOST·½·¨·¢Ë͵ıäÁ¿µÄÊý×é
$_COOKIE[]£º ......