PHPµÄÊý¾ÝÀàÐͺÍÊý×éÏê½â
PHPÊÇÈõÀàÐÍÓïÑÔ¡£
»ù±¾Êý¾ÝÀàÐÍ£ºinteger¡¢string¡¢boolean¡¢float
¸´ºÏÊý¾ÝÀàÐÍ£ºarray¡¢object
»ù±¾Êý¾ÝÀàÐ;Ͳ»ËµÁË£¬ÏÂÃæ¿´Ò»¸öÊý×éÏà¹ØµÄһЩÀý×Ó¡£
$test1=array(1,2,3,4);//¶¨ÒåÁËÒ»¸ö°üº¬4¸öÊýµÄÊý×é
$test1=array("new1"=>1,"new2"=>2);//Á½¸ö±äÁ¿µÄÊý×é,array['new1']=1,array['new2']=2
¶àάÊý×飺
$arr=array(array(4,3),array(3,6));ÕâÊÇÒ»¸ö¶þάÊý×é
Êä³öÊý×éµÄ·½·¨ÓУº
print_r($arr);//´ËÖÖ·½·¨Êä³öºóΪarray([0]=>1,[1]=>2)µÄÐÎʽ
echo $arr[0];//µ¥¸öÊä³ö
ÓйØÊý×éµÄһЩº¯Êý£º
count($arr);//ͳ¼ÆÊý×éÌõÊý
is_array($arr);//ÅжÏÊÇ·ñÊý×é
explode("key",value);//ÁíÒ»ÖÖ´´½¨Êý×éµÄ·½·¨,ÏÂÃæ½øÐмòµ¥ËµÃ÷¡£
¹ØÓÚecplodeº¯ÊýµÄʹÓÃ
$a="1986-1987-1988";
$arr=explode("-",$a);//½«$aÕâ¸ö±äÁ¿ÒÔ"-"Ϊ·Ö¸îÏߣ¬²ð³ÉÊý×é²¢·ÅÈëÊý×éarrÖÐ
ÀûÓÃforeach()º¯Êý±éÀúÊý×é
$arr=(1980,1981,1982,1983,1984,1985,1986);
foreach($arr as $key=>$value){
echo $value;
echo "<br/>";
}
Ïà¹ØÎĵµ£º
°ÑphpÊý¾Ý»òÖµ´«µÝ¸øjs
£ººÜ¼òµ¥£¬Ö±½ÓÔÚjsÖÐʹÓÃphp´úÂ룬»ì±à¼´¿É¡£
°ÑjsÊý¾Ý´«µÝ¸øphp
£º¿ÉÒÔʹÓôò¿ªÐ´°¿ÚµÄ·½Ê½£¬Í¨¹ýurlµØÖ·°ÑÊý¾Ý´«µÝ¹ýÈ¥¡£Ò²¿ÉÒÔʹÓÃajax£¬Í¨¹ýget»òpost´«µÝ¸øphp£¬Ò²¿ÉÒÔ±£´æcookieÈÃphpÀ´¶Á¡£
ÔÚ´«µÝÊý¾Ý¹ý³ÌÖпÉÄÜÓöµ½ÖÐÎıàÂë
ÎÊÌ⣬¿ÉÒÔͳһ±àÂ뷽ʽΪjsµÄescape£¬unescape£¬Ò²¿ÉÒÔÍ³Ò ......
Ò».Ê×ÏÈÊÇPHPÍøÒ³µÄ±àÂë
¡¡¡¡1.phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
¡¡¡¡a.Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪANSI£¬¿ÉÓüÇʱ¾´ò¿ª£¬Áí´æΪѡÔñ±àÂëΪANSI£¬¸²¸ÇÔ´Îļþ¡£
¡¡¡¡b.Èç¹ûÓûʹÓÃutf-8±àÂ룬ÄÇôphpÒªÊä³ ......
1. ¾¡Á¿²ÉÓôóÁ¿µÄPHPÄÚÖú¯Êý¡£
2. echo ±È print ¿ì¡£
3. ²»Òª°Ñ·½·¨Ï¸·ÖµÃ¹ý¶à£¬×ÐϸÏëÏëÄãÕæÕý´òËãÖØÓõÄÊÇÄÄЩ´úÂ룿
4. ÔÚÖ´ÐÐforÑ»·Ö®Ç°È·¶¨×î´óÑ»·Êý£¬²»ÒªÃ¿Ñ»·Ò»´Î¶¼¼ÆËã×î´óÖµ¡£
5. ×¢ÏúÄÇЩ²»ÓõıäÁ¿ÓÈÆäÊÇ´óÊý×飬ÒÔ±ãÊÍ·ÅÄÚ´æ¡£
6. ²¢·ÇÒªÓÃÀàʵÏÖËùÓеÄÊý¾Ý½á¹¹£¬Êý×éÒ²ºÜÓÐÓá£
7. $row['id']µÄÐ ......
$URL
=‘
http
:
//xxx.xxx.xxx.xx/xx/xxx/top.php';
$post_data
[
'
clientname
'
]
=
"
test08
"
;
$post_data
[
'
clientpasswd
'
]
=
"
test08
"
;
$post_data
[
'
submit
'
]
=
"
¥í¥°¥¤¥ó
"
;
$referrer
=
""
;
// ......
<?php
class ClientGetObj{
function getOS(){
global $_SERVER;
$agent=$_SERVER["HTTP_USER_AGENT"];
$os=false;
if(eregi("win",$agent)&&strpos($agent,"95")){
$os="Windows 95";
}else if(eregi("win 9x",$agent)&&strpos($agent,"4.90")){
$os="Windows ME";
}else ......