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

PHP²¿·Ö³£¼ûËã·¨


//1. Óû§ÃÜÂëÁùλÊý,²»ÄÜ´óÓÚÁùλ¶ø²»ÄÜСÓÚÁùÊý,Êý×ÖÖµÕýÔòΪ[0-9],ÇëÓÃPHPд³öÓм¸ÖÖ¿ÉÄÜÐÔ,²¢×ö±©Á¦Æƽâ;
function dePassword($pwd) {
$tmp = array('000000', '555555', '999999');
for ($i = 0; $i < 3; $i++) {
if ($pwd == $tmp[$i]) return $tmp[$i];
}
return $pwd < $tmp[1] ? getPwd(0, $pwd, $tmp) : getPwd(1, $pwd, $tmp);
}
function getPwd($i, $pwd, $tmp) {
$half = ceil(($tmp[$i] + $tmp[$i + 1]) / 2);
if ($half == $pwd) {
return $half;
} elseif ($half > $pwd) {
return returnI($pwd, $tmp[$i], $half);
} else {
return returnI($pwd, $half, $tmp[$i + 1]);
}
}
function returnI($pwd, $start, $end){
for ($i = $start + 1; $i < $end; $i++) {
if ($i == $pwd) return $i;
}
}
$pwd = '000089';
printf('%06s', dePassword($pwd));
//2.Å£ÄêÇóÅ££ºÓÐһĸţ£¬µ½4Ëê¿ÉÉúÓý£¬Ã¿Äêһͷ£¬ËùÉú¾ùÊÇÒ»ÑùµÄĸţ£¬µ½15Ëê¾øÓý£¬²»ÔÙÄÜÉú£¬20ËêËÀÍö£¬ÎÊnÄêºóÓжàÉÙÍ·Å£
function niunum($n) {
static $num = 1;
for ($i = 1; $i <= $n; $i++) {
if ($i >= 4 && $i < 15) {
$num++;
niunum($n - $i);
}
if ($i == 20) $num--;
}
return $num;
}
echo niunum(10);
//3.ºÏ²¢¶à¸öÊý×飬²»ÓÃarray_merge()£¬Ë¼Â·£º±éÀúÿ¸öÊý×飬ÖØÐÂ×é³ÉÒ»¸öÐÂÊý×é¡£
function unionArray($a, $b) {
$re = array();
foreach ($a as $v) $re[] = $v;
foreach ($b as $v) $re[] = $v;
return $re;
}
print_r(unionArray(array(1,2,4,5,'s'), array(2,5,7,'c','d')));
/*4.¶þ·Ö·¨²éÕÒ
*˼·£ºÒÔÊý×éÖÐij¸öֵΪ½ç£¬Ôٵݹé½øÐвéÕÒ£¬Ö±µ½½áÊø¡£
*/
$a = array(1,4,2,5,6,7,0,8,3);
function find($arr, $start, $end, $key) {
sort($arr);
$mid = ceil(($start + $end) / 2);
if ($arr[$mid] == $key) {
return $mid;
} elseif ($arr[$mid] > $key) {
return find($arr, $start, $mid - 1, $key);
} else {
return find($arr, $mid + 1, $end, $key);
}
}
echo find($a, 0, count($a), 2);
//5.ðÅÝÅÅÐò·¨
function mSort($a) {
$len = count($a);
for ($i = 0; $i < $len - 1; $i++) {
for ($j = $i; $j < $len; $j++) {
if ($a[$i] > $a[$j]) {
$tmp = $a[$i];
$a[$i


Ïà¹ØÎĵµ£º

PHP±äÁ¿×÷ÓÃÓòµÄ˼¿¼£¡

ÔÚPHP½Å±¾ÖбäÁ¿Ö÷ÒªÓУºÄÚÖ󬼶ȫ¾Ö±äÁ¿£¬Ò»°ãµÄ±äÁ¿£¬³£Á¿£¬È«¾Ö±äÁ¿£¬¾²Ì¬±äÁ¿µÈµÈ£¬ÎÒÃÇÔÚʹÓÃËüÃǵÄʱºò³ýÁËÒªÕýÈ·µØÖªµÀËüÃǵÄÓï·¨ÒÔÍ⣬¸üÖØÒªµÄÊÇ£¬ÎÒÃÇÒªÖªµÀËüÃÇÔÚ±¾ÖÊÉϵÄÇø±ðÓëÁªÏµ—¼´ËüÃǵÄ×÷ÓÃÓòµÄÎÊÌâ¡£
1.ÄÚÖ󬼶ȫ¾Ö±äÁ¿¿ÉÒÔÔڽű¾µÄÈκεط½Ê¹ÓúͿɼû¡£¼´ÊÇ˵£¬Èç¹ûÎÒÃÇÔÚÒ»¸öPHPÒ³ÃæÖиıäÁËÆ ......

phpͼƬÉÏ´«ÐĵÃ

ÔÚphpÖвâÊÔµ¥¸öÎļþÉÏ´«ºÍÔÚÍøÉÏä¯ÀÀÁ˺ܶà¹ØÓÚ¶àÎļþÉϴ棬´ó¶à¶¼ÊDz¶àÒ»ÑùµÄ¡£Ö»ÊÇÉÏ´«¶à¸öÎļþÓÃpost´«µÝʱÊÇÊý×é´«µÝ£¬Èç<input type="file" name="pic[]" id="pic">¶øµ¥¸öÎļûÉÏ´«<input type="file" name="pic" id="pic">¡£
Ìá½»Êý¾Ýʱ£¬¶à¸öÎļþÓÃforeach À´Ñ­»·£¬ÆäËûÏÞÖƺ͵¥¸öÎļþÉÏ´«¶¼ÊÇ ......

´î½¨Eclipse PHP¿ª·¢»·¾³

    ´î½¨PHP¿ª·¢»·¾³£º
    1¡¢×¼±¸²¢°²×°ÏÂÁÐÈí¼þ£º
    MySQL 5.1.30: http://dev.mysql.com/downloads/¡£
    Apache 2.2.14: http://httpd.apache.org/. ÔÚ°²×°¹ý³ÌÖÐ,»á³öÏÖ3¸öÎı¾¿ò£¬ÉÏÃæÁ½¸öÊäÈëÄãµÄ±¾»úIP£¨È磺127.0.0.1£©£¬×îÏÂÃæÊäÈëÄãµÄEMAIL ......

ΪÄãÆʽâPHPÐòÁл¯¸ñʽ

¶ÔÓÚÄÇЩ¸Õ¸Õ½Ó´¥PHPÓïÑÔµÄÅóÓÑÀ´Ëµ£¬Ê²Ã´ÊÇPHPÐòÁл¯¸ñʽ¿ÉÄÜ´ó¼Ò¶¼»¹ÊDz»Ì«Çå³þ¡£ÎÒÃǽñÌì¾ÍΪ´ó¼ÒÏêϸ½²½âÕâÒ»·½ÃæµÄ֪ʶ¡£
PHP £¨´Ó PHP 3.05 ¿ªÊ¼£©Îª±£´æ¶ÔÏóÌṩÁËÒ»×éÐòÁл¯ºÍ·´ÐòÁл¯µÄº¯Êý£ºserialize¡¢unserialize¡£²»¹ýÔÚ PHP ÊÖ²áÖжÔÕâÁ½¸öº¯ÊýµÄ˵Ã÷½öÏÞÓÚÈçºÎʹÓ㬶ø¶ÔÐòÁл¯½á¹ûµÄ¸ñʽȴû×öÈκÎ˵Ã÷¡£ ......

php¼ÓÈëlinuxϵͳÃüÁî


¼ÙÉèphp°²×°ÔÚ/usr/local/php5/bin/php£¬³õʼÔÚÃüÁîÐÐÖ´ÐÐPHPµÄʱºòÒªÊäÈëÒ»³¤´®µÄ·¾¶£¬eg£º
$>/usr/local/php5/bin/php phpinfo.php
·Ç³£µÄÂé·³£¬ÏÖÔÚÖ»Ð轫php¿½±´ÖÁusr/sbinĿ¼¼´¿ÉÖ±½ÓʹÓÃphpÃüÁeg£º
$>cp /usr/local/php5/bin/php /usr/sbin/
$>php phpinfo.php
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ