PHPÊý×éµÄÈëÕ»Óë³öÕ»
ÔÚPHPÖУ¬Èëջͨ¹ýarray_pushº¯ÊýʵÏÖ£¬Óï·¨ÈçÏ£º
int array_push(array,var [,var …])
varΪҪѹÈëÊý×éµÄÔªËØ£¬arrayΪÊý×é¡£º¯Êý·µ»ØÊý×éеÄÔªËØ×ÜÊý¡£
ÀýÈ磺
<?php
$php = array("php","phpdo","phpѧϰ");
print_r($php);
array_push($php,"ÔõÑùѧϰPHP","seo");
print_r($php);
?>
½á¹û£º
Array ( [0] => php [1] => phpdo [2] => phpѧϰ )
Array ( [0] => php [1] => phpdo [2] => phpѧϰ [3] => ÔõÑùѧϰPHP [4] => seo )
¿ÉÒÔ¿´µ½£¬array_pushº¯Êý½«ÔªËØѹÈëÁËÊý×éµÄĩβ¡£
Äܲ»Äܽ«ÔªËØѹÈëµ½Êý×éµÄÆäËûµØ·½ÄØ£¿
×îÇ°±ßµÄʹÓÃarray_unshift¾ÍOK£¬ÖÁÓÚÖ¸ÄÄ´òÄľ͹»ÇºÁË¡£ºÇºÇ£¡
ÀýÈ磺
<?php
$php = array("php","phpdo","phpѧϰ");
print_r($php);
array_unshift($php,"ÔõÑùѧϰPHP","seo");
print_r($php);
?>
½á¹û£º
Array ( [0] => php [1] => phpdo [2] => phpѧϰ )
Array ( [0] => ÔõÑùѧϰPHP [1] => seo [2] => php [3] => phpdo [4] => phpѧϰ )
£Ð£È£ÐÊý×éµÄ³öÕ¾
ÔÚPHPÖУ¬ÔõôʵÏÖÊý×éµÄ³öÕ»ÄØ£¿
yes!array_popº¯Êý¿ÉʵÏÖ¡£Óï·¨ÈçÏ£º
array_pop(array)
array_popº¯Êý½«·µ»Ø±»É¾³ýµÄÔªËØ¡£
ÀýÈ磺
<?php
//$phpÊÇÊý×飬$dele Ϊ±»É¾³ýµÄyuansu
$php = array("php","phpdo","phpѧϰ");
print_r($php);
echo array_pop($php)."\n";
print_r($php);
?>
½á¹û£º
Array ( [0] => php [1] => phpdo [2] => phpѧϰ )
phpѧϰ
Array ( [0] => php [1] => phpdo )
Ò²Ðíµ½ÕâÀÎÒÃÇ»áÏ룺ɾ³ý×îÇ°±ßµÄÔªËØÔõôɾ³ýÄØ£¿²»»áÒ»¸öÒ»¸öÈ«²¿É¾³ýÁË°É£¿¿ÉÒÔ¡£µ«ÊÇ£¬Èç¹ûÖ»ÊÇɾ³ýÇ°±ßµÄÔªËضø±£ÁôºóÃæµÄÔªËØÓÖÔõô°ìÄØ£¿
array_shiftº¯Êý¾Í³öÀ´ÁË¡£
ÀýÈ磺
<?php
//$phpÊÇÊý×飬$dele Ϊ±»É¾³ýµÄyuansu
$php = array("php","phpdo","phpѧϰ");
print_r($php);
echo array_shift($php)."\n";
print_r($p
Ïà¹ØÎĵµ£º
The define() function defines a constant.
define()º¯ÊýµÄ×÷ÓÃÊÇ£º¶¨ÒåÒ»¸ö³£Á¿¡£
Constants are much like variables, except for the following differences:
³£Á¿[constant]Óë±äÁ¿[variable]ÓкܶàÏàËƵĵط½£¬Òò´Ë£¬ºÜÈÝÒ×»ìÏý£»ÏÂÃ棬ÎÒÃÇÁоÙһϳ£Á¿[constant]Óë±äÁ¿[variable]Ö®¼äµÄ²»Í¬µã£º
A const ......
1¡¢Ê¹Óõ¥ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û´®
µ±Ê¹ÓÃË«ÒýºÅÀ´À¨×Ö·û´®Ê±£¬PHP½âÊÍÆ÷»á¶ÔÆä½øÐбäÁ¿Ìæ»»¡¢×ªÒåµÈ²Ù×÷£¬Èç
“\n”¡£Èç¹ûÖ»ÏëÊä³öÒ»¸ö»ù±¾µÄ×Ö·û´®£¬Óõ¥ÒýºÅ»á½ÚʡһЩ×ÊÔ´¡£µ±È»£¬Èç¹ûÐèÒª½øÐбäÁ¿Ìæ»»µÄ£¬ÄǾͱØÐëÓÃË«ÒýºÅÁË¡£
2¡¢×Ö·û´®µÄÊä³ö
ÒÔÏÂÄÄÒ»ÌõÓï¾äµÄÔËÐÐËÙ¶È×î¿ì£¿
print “Hi my name is ......
PHPº¯Êýsetcookie()ÓÃÀ´ÉèÖÃcookie.
setcookie()º¯Êý±ØÐëÔÚ<html>±êǩ֮ǰµ÷Óã¬Óï·¨ÊÇsetcookie (name, value, expire,
path, domain) ÀýÈ磺
<?php
setcookie(”user”, “Alex
Porter”, time()+3600);
?>
<?php
setcookie(”url”, “http://www.mianwww. ......
ÓÃPHPʵÏÖ¼òµ¥µÄÊý¾Ýץȡ
·½·¨Ò»£º
<?php
$urlstr = file_get_contents("http://www.baidu.com");
$urlstr = htmlspecialchars($urlstr);
print_r($urlstr);
?>
·½·¨¶þ£º£¨ÐèÒª´ò¿ªcurlÀ©Õ¹£©
×¢Ò⣺´ò¿ªcurlÀ©Õ¹Ê±£¬Ò»¶¨Òª¿´¿ ......
Óõ¥ÒýºÅ´úÌæË«ÒýºÅÀ´°üº¬×Ö·û´®£¬ÕâÑù×ö»á¸ü¿ìһЩ¡£ÒòΪPHP»áÔÚË«ÒýºÅ°üΧµÄ×Ö·û´®ÖÐËÑÑ°±äÁ¿£¬µ¥ÒýºÅÔò²»»á£¬×¢Ò⣺ֻÓÐechoÄÜÕâô×ö£¬ËüÊÇÒ»ÖÖ¿ÉÒ԰Ѷà¸ö×Ö·û´®µ±×÷²ÎÊýµÄ“º¯Êý”£¨Òë×¢£ºPHPÊÖ²áÖÐ˵echoÊÇÓïÑԽṹ£¬²»ÊÇÕæÕýµÄº¯Êý£¬¹Ê°Ñº¯Êý¼ÓÉÏÁËË«ÒýºÅ£©¡£
1¡¢Èç¹ûÄܽ«ÀàµÄ·½·¨¶¨Òå³Éstatic£¬¾Í¾¡Á¿¶¨Ò ......