PHPº¯Êý(2)
in_array(value,array,type) //¼ì²éÒ»¸öÖµÊÇ·ñÔÚÊý×éÖÐ,type¿ÉÑ¡,ÉèÖÃΪtrue¼ì²éÀàÐÍÊÇ·ñÏàͬ,·Ö´óСд
Àý:
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {
echo "Got mac";
}
µÚ¶þ¸öÌõ¼þʧ°Ü£¬ÒòΪ in_array() ÊÇÇø·Ö´óСдµÄ£¬ËùÒÔÒÔÉϳÌÐòÏÔʾΪ:
Got Irix
in_array() ÑϸñÀàÐͼì²éÀý×Ó
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check\n";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict check\n";
}
ÉÏÀý½«Êä³ö£º
1.13 found with strict check
in_array() ÖÐÓÃÊý×é×÷Ϊ needle
$a = array(array('p', 'h'), array('p', 'r'), 'o');
if (in_array(array('p', 'h'), $a)) {
echo "'ph' was found\n";
}
if (in_array(array('f', 'i'), $a)) {
echo "'fi' was found\n";
}
if (in_array('o', $a)) {
echo "'o' was found\n";
}
ÉÏÀý½«Êä³ö£º
'ph' was found
'o' was found
Ïà¹ØÎĵµ£º
Linuxϰ²×°PHP5µÄÖ÷Òª²½Öè:
1.ÏÂÔØphp5£»µØÖ·£ºhttp://cn.php.net/downloads.php
2.½âѹÈí¼þ°üºó½øÈë¸ÃĿ¼
£¨×ªÕß×¢£º
¿ÉÄÜ»áÐèÒªÏȽâѹphp-5.*.tar.bz2 ,ÏÈÖ´ÐÐbzip2 -d php-5.*tar.bz2
£©
tar -xvf php-5.*.tar.gz
cd php-5.*
3.php°²×°mysqlµÄÄ£¿éµÄһЩ׼±¸¹¤×÷
ln -s /usr/local/mysql/lib/mysql /usr/l ......
header
(PHP 3, PHP 4, PHP 5)
header -- ·¢ËÍÒ»¸öÔʼ HTTP ±êÍ·
˵Ã÷
void header ( string string [, bool replace [, int http_response_code]] )
header() º¯ÊýÓÃÀ´·¢ËÍÒ»¸öÔʼ HTTP ±êÍ·¡£ÓÐ¹Ø HTTP ±êÍ·µÄ¸ü¶àÄÚÈݼû HTTP/1.1 ¹æ·¶¡£
¿ÉÑ¡²ÎÊý replace Ö¸Ã÷ÊÇÌæ»»µôǰһÌõÀàËÆµÄ±êÍ·»¹ÊÇÔö¼ÓÒ»ÌõÏàͬÀàÐ͵ ......
__LINE__ ÎļþÖеĵ±Ç°Ðкš£
__FILE__ ÎļþµÄÍêÕû·¾¶ºÍÎļþÃû¡£Èç¹ûÓÃÔÚ±»°üº¬ÎļþÖУ¬Ôò·µ»Ø±»°üº¬µÄÎļþÃû¡£×Ô PHP 4.0.2 Æð£¬__FILE__
×ÜÊǰüº¬Ò»¸ö¾ø¶Ô·¾¶£¨Èç¹ûÊÇ·ûºÅÁ¬½Ó£¬ÔòÊǽâÎöºóµÄ¾ø¶Ô·¾¶£©£¬¶øÔÚ´Ë֮ǰµÄ°æ±¾ÓÐʱ»á°üº¬Ò»¸öÏà¶Ô·¾¶¡£
__DIR__ ÎļþËùÔÚµÄĿ¼¡£Èç¹ûÓÃÔÚ±»°üÀ¨ÎļþÖУ¬Ôò· ......
µÚÒ»²½ °²×°MySQL
[root@localhost usr]# groupadd mysql
[root@localhost usr]# useradd -g mysql mysql
[root@localhost usr]# cd /usr/local
[root@localhost local]# tar -zxvf mysql-5.0.51.tar.gz
[root@localhost local]# cd mysql-5.0.51
[root@localhost mysql-5.0.51# ./configure --prefix=/usr/local/my ......
PHPÊÇÒ»¸öºÜÓÅÐãµÄ¹¤¾ß£¬Ëü¿ÉÒÔ¼òµ¥£¬Ò²¿ÉÒÔ¸´ÔÓ¡£²»Ò»ÑùµÄÏîÄ¿£¬Ó¦¸ÃÓò»Ò»ÑùµÄPHP¡£
СÏîÄ¿ – ¼òµ¥¶øÖ±½ÓµÄPHP
Ò»°ã¶ÔÓÚÒ»¸ö¹¦ÄÜÒ³ÃæÔÚ20ÒÔϵÄÍøÕ¾£¬ÎÒÃÇ¿ÉÒÔÓÃÒ»¸öºÜ¼òµ¥µÄ¿ò¼Ü½á¹¹À´Ð´¡£ÔÚÕâ¸ö¹æÄ£ÉÏ£¬ÎÒ½¨ÒéÊÇʹÓñȽÏÖ±½ÓµÄÃæÏò¹ý³Ì±àÂë·½·¨£¬ÔÒòºÜ¼ò µ¥£¬Ã»ÓбØÒª°ÑclassÎļþŪµÄN ......