PHPÊý¾ÝÀàÐÍ
PHPÊý¾ÝÀàÐÍ£¬ÓаËÖÖÔʼÀàÐÍ
ËÄÖÖ±êÁ¿ÀàÐÍ
²¼¶ûÐÍ£¨boolean£©
ÕûÐΣ¨integer£©
¸¡µãÐÍ£¨fload¡¢Ò²×ödouble£©
×Ö·û´®£¨string£©
Á½ÖÖ¸´ºÏÀàÐÍ
Êý×飨array£©
¶ÔÏó£¨object£©
Á½ÖÖÌØÊâÀàÐÍ
×ÊÔ´£¨resource£©
NULL
PHPÊÇÒ»ÖÖÈõÀàÐÍÓïÑÔ£¬ÔÚ´ó¶àÊý±à³ÌÓïÑÔÖУ¬±äÁ¿Ö»Äܱ£³ÖÒ»ÖÖÀàÐ͵ÄÊý¾Ý£¬¶øÇÒÕâ¸öÀàÐͱØÐëÔÚʹÓñäÁ¿Ç°ÉùÃ÷£¬ÀýÈçCÓïÑÔ¡¢JavaÓïÑÔÖУ¬¶¼ÐèÒªÔÚÉùÃ÷±äÁ¿Ê±Ö¸¶¨Êý¾ÝÀàÐÍ¡£È»¶ø£¬PHP±äÁ¿µÄÊý¾ÝÀàÐͲ»ÐèÒª½øÐÐÉùÃ÷£¬PHP±äÁ¿µÄÊý¾ÝÀàÐÍÊǸù¾Ý¸Ã±äÁ¿Ê¹ÓõÄÉÏÏÂÎÄÔÚÔËÐÐʱ£¨¼´±äÁ¿µÄÖµ£©¾ö¶¨µÄ¡£
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php
$bool = true; // ²¼¶ûÐÍ
$str = "foo"; // ×Ö·û´®
$int = 12; // ÕûÐÍ
//»ñÈ¡Êý¾ÝÀàÐÍ
echo gettype($bool); // Êä³ö boolean
echo gettype($str); // Êä³ö string
echo gettype($int); // Êä³ö integer
$var=12;
echo $var; //Êä³ö 12
$var="hello";
echo $var; //Êä³ö hello
?>
<?php
$bool = true; // ²¼¶ûÐÍ
$str = "foo"; // ×Ö·û´®
$int = 12; // ÕûÐÍ
//»ñÈ¡Êý¾ÝÀàÐÍ
echo gettype($bool); // Êä³ö boolean
echo gettype($str); // Êä³ö string
echo gettype($int); // Êä³ö integer
$var=12;
echo $var; //Êä³ö 12
$var="hello";
echo $var; //Êä³ö hello
?>
1¡¢ÕûÐÎ
ÕûÐÍÖµ¿ÉÒÔÓÃÊ®½øÖÆ¡¢°Ë½øÖÆ¡¢Ê®Áù½øÖÆÖ¸¶¨£¬Ç°Ãæ¿ÉÒÔÑ¡Ôñ¼ÓÉÏÕý¸ºµÄ·ûºÅ£¨+»ò-£©
Îı¾²é¿´¸´ÖÆ´úÂë´òÓ¡¹ØÓÚ
<?php
$num_int = 1234; // Ê®½øÖÆÊý
$num_int = -123; // Ò»¸ö¸ºÊý
$num_int = 0123;
Ïà¹ØÎĵµ£º
ÈçºÎ²»Ê¹ÓÃprepared statment£¬¶øÊÇÓùýÂ˵ķ½·¨±ÜÃâSQL×¢ÈëÄØ£¿
Ò»°ãÀ´Ëµmysql×Ô´øµÄ¹ýÂ˺¯ÊýÊDZȽϿɿ¿µÄ¡£mysql_real_escape_string()
µ«ÊÇÕâ¸öº¯ÊýÔÚijЩ×Ö·û¼¯ÖÐÓÐÎÊÌ⣬±ÈÈçGBK¡£Èç¹ûÄãÓÃUTF8ÄÇû¹Øϵ¡£
ÔÚPHPÀïÉèÖÃÊý¾Ý¿âµÄ×Ö·û¼¯²»Ó¦¸ÃÓãºmysql_query("SET NAMES UTF8");
¶øÓ¦¸ÃÓãºmysql_set_charset()
ÕâÑù ......
$ip = "1.1.1.255".chr(0)."haha";
if(ereg("^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$",$ip)) {
echo $ip;
} else {
echo "unknown";
}
Õâ¸öeregÕýÔòÏÞÖÆÁË$ipµÄÊý¾ÝΪxxx.xxx.xxx.xxxÕâÑùµÄÐÎʽ£¬±íÃæÉÏ¿´ÉÏÃæµÄ´úÂëÓ¦¸ÃÊä³ö"unknown"£¬¶øʵ¼ÊÈ´Êä³öÁË"1.1.1.255haha"£¬ÒòΪeregº¯Êý´æÔÚNULL½Ø¶Ï ......
Ò»¡¢µÇ½
1.½øÈëlinux
2.̞: root
3.¿ÚÁî:123456
4.mysql Óû§Ãû root ÃÜÂë 123456
¶þ¡¢Æô¶¯mysqlÓëapache·þÎñ
1.Æô¶¯mysqÊý¾Ý¿â:/usr/local/mysql/bin/./mysqld_safe --user=mysql &
2.Í£Ö¹mysqlÊý¾Ý¿â:/usr/local/mysql/bin/mysqladmin -u root -p shutdown
3.Æô¶¯apache: /usr/local/apache2/bin/./ap ......
PHPÊý¾ÝÀàÐÍת»»Ï¸½Ú
1¡¢Êý×Ö£¨ÕûÐκ͸¡µãÐÍÖ®¼ä¿ÉÒÔÏ໥ת»¯£©
ÕûÐÎת»»Îª¸¡µãÐÍ£ºÓÉÓÚ¸¡µãÐ͵ľ«¶È·¶Î§Ô¶´óÓÚÕûÐΣ¬ËùÒÔת»»ºóµÄÊýÖµ¾«¶È²»»á¸Ä±ä¡£
¸¡µãÐÍת»»ÎªÕûÐΣº½²×Ô¶¯ÉáÆúСÊ÷²¿·Ö£¬Ö»±£ÁôÕûÊý²¿·Ö¡£×¢£ºÈç¹ûÒ»¸ö¸¡µãÐͳ¬¹ýÕûÊýÈ¡ÖµµÄÓÐЧ·¶Î§£¬Æä½á¹û½«ÊÇÎÞ·¨È·¶¨µÄ£¨ÕûÊýµÄ×î´óÖµÔ¼ÊÇ2.147e9£©¡£
¡¾Ê¾Àý¡ ......