phpѧϰ֪ʶµã
1.call_user_func º¯ÊýÀàËÆÓÚÒ»ÖÖÌرðµÄµ÷Óú¯ÊýµÄ·½·¨£¬Ê¹Ó÷½·¨ÈçÏÂ:
function a($b,$c)
{
echo $b;
echo $c;
}
call_user_func('a','111','222');
call_user_func('a','333','444');
//ÏÔʾ111222333444
µ÷ÓÃÀàÄÚ²¿µÄ·½·¨±È½ÏÆæ¹Ö£¬ÓõÄÊÇarray,Óëphp5µÄ¾²Ì¬·½·¨Ïàͬ£¬¼´µÈͬÓÚclass:function
class a{
function b($c){
echo $c;
}
}
call_user_func(array("a","b"),"1111");
//Êä³ö1111
2.array_fill()º¯Êý½«¸øº¯Êý¸³ÉÏÄãËùÉ趨µÄÖµ¡£
Example:
$a=array_fill(2,3,"Dog");
print_r($a);
//Êä³ö½á¹û:Array ( [2] => Dog [3] => Dog [4] => Dog )
3.µÑ¿¨¶û»ýËã·¨:
$a[0] = array(1, 2, 3, 4);
$a[1] = array(5, 6, 7);
$a[2] = array(8, 9);
$index = array_fill(0, count($a), 0);
while ($index[0] < count($a[0])) {
$temp = '';
for ($i = 0; $i < count($index); ++$i) {
$temp .= $a[$i][$index[$i]];
}
echo $temp, '<br/>';
++$index[count($index) - 1];
for ($i = count($index) - 1; $i > 0; --$i) {
if ($index[$i] >= count($a[$i])) {
$index[$i] = 0;
++$index[$i - 1];
}
}
}
4.phpÖвÙ×÷XMLÎļþ
$xml = '<news><item id="1"><title>Item1</title></item><item
id="2"><title>Item2</title></item></news>';
$doc = new DOMDocument();
$doc->loadXML($xml);
foreach($doc->getElementsByTagName('item') as $item)
{
$item->setIdAttribute('id', true);
}
echo $doc->getElementById('1')->childNodes->item(0)->nodeValue;//Item1
5.mysql_escape_string
$user = mysql_escape_string($_GET['user']);
mysql_escape_string:תÒåÒ»¸ö×Ö·û´
Ïà¹ØÎĵµ£º
phpÒýÓÃ(&)Ïê½â
2009-05-13 14:30
phpµÄÒýÓ㨾ÍÊÇÔÚ±äÁ¿»òÕߺ¯Êý¡¢¶ÔÏóµÈÇ°Ãæ¼ÓÉÏ&·ûºÅ£©
ÔÚPHP ÖÐÒýÓõÄÒâ˼ÊÇ£º²»Í¬µÄÃû×Ö·ÃÎÊͬһ¸ö±äÁ¿ÄÚÈÝ.
Óë£ÃÓïÑÔÖеÄÖ¸ÕëÊÇÓвî±ðµÄ£®£ÃÓïÑÔÖеÄÖ¸ÕëÀïÃæ´æ´¢µÄÊDZäÁ¿µÄÄÚÈÝÔÚÄÚ´æÖдæ·ÅµÄµØÖ·
±äÁ¿µÄÒýÓÃ
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 ......
Êý×é
ÔÚʹÓà PHP ½øÐпª·¢µÄ¹ý³ÌÖУ¬»òÔç»òÍí£¬Äú»áÐèÒª´´½¨Ðí¶àÏàËƵıäÁ¿¡£ÎÞÐèºÜ¶àÏàËƵıäÁ¿£¬Äã¿ÉÒÔ°ÑÊý¾Ý×÷ΪԪËØ´æ´¢ÔÚÊý×éÖС£Êý×éÖеÄÔªËض¼ÓÐ×Ô¼ºµÄ ID£¬Òò´Ë¿ÉÒÔ·½±ãµØ·ÃÎÊËüÃÇ¡£
ÓÐÈýÖÖÊý×éÀàÐÍ£º
ÊýÖµÊý×é
´øÓÐÊý×Ö ID ¼üµÄÊý×é
¹ØÁªÊý×é
Êý×éÖеÄÿ¸ö ID ¼ü¹ØÁªÒ»¸öÖµ
¶àάÊý×é
°üº¬Ò»¸ö»ò¶à¸öÊý×éµÄ ......
Ç°ÑÔ
¡¡¡¡
¡¡¡¡·Ï»°²»¶à˵£¬WebServiceÕâ¸öÈÈ°¡£¬PHPÕâ¸ö»ð°¡£¬ÏëÓÃPHP¿ª·¢WebServiceÊÇÀíËùµ±È»µÄÊ¡£Ê²Ã´£¿²»¶®WebService£¿Ã»Ê£¬°Ù¶ÈһϾÍÖªµÀÁË¡£°¡£¿¿´²»¶®£¿²»¶®Ò²Ã»¹Øϵ£¬Ö±½Ó¿´´óÉÙүдµÄ°É£º£©
¡¡¡¡´óÉÙÒ¯ÊǸö¼¤½ø·Ö×Ó£¬Ï²»¶Ö±½ÓÄôúÂë˵Ê£¬²»¹ýÔÚ°Ñ¿ÉÁ¯µÄ¶ÁÕßŪµÃһͷÎíˮ֮ǰ£¬»¹ÊÇÏÈ´óÖÂ˵һϱ¾ÎĵÄÄ¿ ......
4 ·â×°
·â×°ÐÔÊÇÃæÏò¶ÔÏó±à³ÌÖеÄÈý´óÌØÐÔÖ®Ò»£¬·â×°ÐÔ¾ÍÊǰѶÔÏóµÄÊôÐԺͷþÎñ½áºÏ³ÉÒ»¸ö¶ÀÁ¢µÄÏàͬµ¥Î»£¬²¢¾¡¿ÉÄÜÒþ±Î¶ÔÏóµÄÄÚ²¿Ï¸½Ú£¬Ê¹¶à¸öϵͳģ¿é¶ÔÏóÐγÉÒ»¸öËÉñîºÏµÄ¹Øϵ¡£·â×°°üº¬Á½¸öº¬Òå:1.°Ñ¶ÔÏóµÄÈ«²¿ÊôÐÔºÍÈ«²¿·þÎñ½áºÏÔÚÒ»Æð£¬ÐγÉÒ»¸ö²»¿É·Ö¸îµÄ¶ÀÁ¢µ¥Î»£¨¼´¶ÔÏ󣩡£2.ÐÅÏ¢Òþ±Î£¬¼´¾¡¿ÉÄÜÒþ±Î¶ÔÏóµÄÄÚ²¿Ï¸½ ......