PHP±äÁ¿ºÍ³£Á¿»ù´¡Ñ§Ï°
ÓйرäÁ¿µÄ´«µØÖ·¸³Öµ
PHP 3 ÖУ¬±äÁ¿×ÜÊÇ´«Öµ¸³Öµ¡£PHP 4
ÌṩÁËÁíÍâÒ»ÖÖ·½Ê½¸ø±äÁ¿¸³Öµ£º´«µØÖ·¸³Öµ¡£Ê¹Óô«µØÖ·¸³Öµ£¬¼´¼òµ¥µØ×·¼ÓÒ»¸ö£¨&£©·ûºÅµ½½«Òª¸³ÖµµÄ±äÁ¿Ç°£¨Ô´±äÁ¿£©¡£Öйú×Ôѧ±à³ÌÍø£¬www.zxbc.cn
ÕâÒâζ×ÅеıäÁ¿¼òµ¥µÄÒýÓÃÁËÔʼ±äÁ¿,¸Ä¶¯ÐµıäÁ¿½«Ó°Ïìµ½Ôʼ±äÁ¿£¬·´Ö®ÒàÈ»¡£
<?php
$foo = \'Bob\';
$bar =
&$foo;
$bar = \"My name is $bar\";
echo $bar;
echo $foo;
?>
±äÁ¿fooÖ»ÔÚÊ×Ðб»¸³Öµ£¬Õý³£Ó¦Êä³öΪ“Bob”£¬È»¶ø´«Ö·¸³Öµ¸ø±äÁ¿bar£¬ÔÚ±äÁ¿barÖµ·¢Éú±ä»¯µÄͬʱ£¬±äÁ¿fooµÄÖµÒ²·¢ÉúÁ˱仯¡£
¹ØÓÚ£¨³¬£©È«¾Ö±äÁ¿
PHPÈ«¾Ö±äÁ¿µÄÉùÃ÷ÊÇÔÚÒýÓñäÁ¿Ê±ÉùÃ÷µÄ£¬¶ø·ÇÔÚ³ÌÐòÊ×Ðж¨Òå¡¢¸³Öµ±äÁ¿Ê±À´¶¨ÒåÊÇÈ«¾Ö»¹ÊǾֲ¿±äÁ¿¡£
<?php
$a = 1;
$b = 2;
function Sum()
{
global $a, $b;
$b = $a + $b;
}
Sum();
echo $b;
?>
Èç¹ûº¯ÊýSum()ÄÚûÓÐʹÓÃglobalÉùÃ÷È«¾Ö±äÁ¿£¬³ÌÐò»á±¨´í䶨ÒåµÄ±äÁ¿¡£
µ±È»£¬ÔÚPHPÖл¹ÓÐһЩ±äÁ¿ÔÚij³ÌÐò¹¦ÄÜ·¶Î§ÄÚÊDz»ÐèÒªglobalÉùÃ÷£¬ÕâЩ±äÁ¿³ÆΪ
³¬È«¾Ö±äÁ¿£¬¶øÕâЩ³¬È«¾Ö±äÁ¿»ù±¾¶¼²»ÊÇÓû§×Ô¶¨ÒåµÄ£¬¶øÊÇPHPÔ¤¶¨ÒåµÄһЩ±äÁ¿£¬±ÈÈç $_GET¡¢$_POST¡¢$_COOKIEµÈ¡£
Óйؿɱä±äÁ¿
PHPÖбȽÏÓÐÒâ˼µÄ¿É±ä±äÁ¿£¬±ÈÈç $a=\"bruce\" £¬»¹¿ÉÒÔʹÓà $$a ±íʾΪ $bruce £¬¼´¿É±ä±äÁ¿ÊÇʹÓõÄÁ½¸öÃÀÔª·ûºÅ¡£
µ«ÆäÖÐÔÚ $$a[1] ÖУ¬ÊÇ $a[1] ×÷Ϊһ¸ö±äÁ¿£¬»¹ÊÇ $$a ×÷Ϊһ¸ö±äÁ¿²¢È¡³ö¸Ã±äÁ¿ÖÐË÷ÒýΪ [1] µÄÖµ£¿ÕâÀïûÓÐÇ°ºóµÄÒÀ´Î¹Øϵ£¬¶øÊÇʹÓÃ
${$a[1]} »ò ${$a}[1] À´±íʾÉÏÊöÁ½ÖÖÇé¿ö¡£
¹ØÓÚ³£Á¿
³£Á¿Çø±ðÓÚ±äÁ¿£¬´Ó³£Á¿±»¶¨ÒåÆðÆ䷶Χ¾ÍÊÇÈ«¾ÖµÄ
Á¿Ä¬ÈÏΪ´óСдÃô¸Ð£¬°´ÕÕ¹ßÀý³£Á¿±êʶ·û×ÜÊÇ´óдµÄ
³£Á¿Ç°ÃæûÓÐÃÀÔª·ûºÅ£¨$£©
³£Á¿Ò»µ©¶¨Òå¾Í²»Äܱ»ÖØж¨Òå»òÕßÈ¡Ïû¶¨Òå
³£Á¿Ö»ÄÜÓà define() º¯Êý¶¨Ò壬¶ø²»ÄÜͨ¹ý¸³ÖµÓï¾ä
±ÈÈç define(\"MYNAME\",\"cnbruce\") ¾ÍÊǶ¨ÒåÁËÒ»¸öֵΪ“cnbruce”µÄMYNAME³£Á¿
<?php
define(\"MYNAME\",\"cnbruce\");
$MYNAME=\"cnrose\";
echo
MYNAME;
echo $MYNAME;
?>
ÁíÍ⣬ÈçºÎ½«³£Á¿ºÍ±äÁ¿µÄÖµÒ»ÆðÊä³ö£¬ÕâÐèÒªÉæ¼°µ½PHPµÄ×Ö·û´®ÔËË㣬ʹÓÃÓ¢ÎľäºÅ£¨.£©¿É½«×Ö·û´®Á¬½ÓºÏ²¢³ÉеÄ×Ö·û´®£¬ÀàËÆASPÖеÄ&¡£
echo MYNAME.\",\".$MYNAME; Êä³öΪ“cnbruce,cnr
Ïà¹ØÎĵµ£º
1.ËùÓеÄÊý¾Ý¶¼Ó¦¸ÃÒþ²ØÔÚËùÔÚµÄÀàµÄÄÚ²¿¡£
2.ÀàµÄʹÓÃÕß±ØÐëÒÀÀµÀàµÄ¹«¹²½Ó¿Ú£¬µ«À಻ÄÜÒÀÀµËûµÄʹÓÃÕß¡£
3.¾¡Á¿¼õÉÙÀàÐÒéÖеÄÏûÏ¢¡£
4.ʵÏÖËùÓÐÀ඼Àí½âµÄ×î»ù±¾µÄ½Ó¿Ú¡££¨¿½±´²Ù×÷£¬°üÀ¨É±´ºÍdz¿½±´£©£¬ÏàµÈÐÔÅжϣ¬ÕýÈ·Êä³öÄÚÈÝ£¬´ÓASC2ÃèÊö½âÎöµÈµÈ¡£
5.²»°ÑʵÏÖϸ½ÚÈç·ÀÖ¹¹«¹²´úÂëµÄ˽Óк¯Êý.·Åµ½ÀàµÄ¹²Óнӿ ......
·µ»ØÒ»¸ö½á¹ûÈ«ÊÀ½ç¶¼ÖªµÀÔõô´¦Àí£¬¹Ø¼üÊÇ·µ»Ø¶à¸ö½á¹û¼¯¾Í²»ºÃ°ìÁË£¬ÏÂÃæÓÐÒ»½â¾ö°ì·¨
´æ´¢¹ý³Ì´úÂë
DELIMITER $$;
DROP PROCEDURE IF EXISTS `test`.`sp_test`$$
CREATE PROCEDURE `test`.`sp_test` ()
BEGIN
select * from `user`.`user` limit 0, 50;
select coun ......
=================================
mb_substr($str, 0, 1, "gbk");
Èç¹ûÌṩÁ˵ÚËĸö²ÎÊý£¬php»á½âÎöÕâ¸ö²ÎÊý
1. ½«Õâ¸ö²ÎÊýת»»³É×Ö·û´®.
2. µ÷ÓÃmbfl_name2no_encoding»ñµÃ±àÂëÆ÷ÐòºÅ
3. µÚ¶þ²½»áµ÷ÓÃmbfl_name2encoding£¬Õâ¸öº¯ÊýÔÚÑ»·ÖÐʹÓÃÁËstrcasecmp
strcasecmpÊǺöÂÔ´óСдµÄ×Ö·û´®Æ¥Å䣬ÐÔÄܺܵͣ¬
......
<?
php define('__TYPECHO_ROOT_DIR__', dirname(__FILE__));
define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins');
@set_include_path(get_include_path() . PATH_SEPARATOR . __TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR . __TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__);
ÄÜÏêϸµÄ½âÊÍÕâ¸öº¯ÊýÂ𣿵±È»Î ......
preg_replace -- Ö´ÐÐÕýÔò±í´ïʽµÄËÑË÷ºÍÌæ»»
array_push -- ½«Ò»¸ö»ò¶à¸öµ¥ÔªÑ¹ÈëÊý×éµÄĩ⣨ÈëÕ»£©
preg_match -- ½øÐÐÕýÔò±í´ïʽƥÅä
exif_imagetype($file) ---ͼÏñÀàÐÍ£»
echo "<SCRIPT LANGUAGE='JavaScript'>alert('µÃµ½');history.back();</SCRIPT>";
exit;
date_defaul ......