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
Ïà¹ØÎĵµ£º
·µ»ØÒ»¸ö½á¹ûÈ«ÊÀ½ç¶¼ÖªµÀÔõô´¦Àí£¬¹Ø¼üÊÇ·µ»Ø¶à¸ö½á¹û¼¯¾Í²»ºÃ°ìÁË£¬ÏÂÃæÓÐÒ»½â¾ö°ì·¨
´æ´¢¹ý³Ì´úÂë
DELIMITER $$;
DROP PROCEDURE IF EXISTS `test`.`sp_test`$$
CREATE PROCEDURE `test`.`sp_test` ()
BEGIN
select * from `user`.`user` limit 0, 50;
select coun ......
<?
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__);
ÄÜÏêϸµÄ½âÊÍÕâ¸öº¯ÊýÂ𣿵±È»Î ......
µÚÒ»ÖÖ·½·¨£º
<?php
class Access{
function getConn(){
$conn = @new COM("ADODB.Connection") or die ("ADOÁ¬½Óʧ°Ü!");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath(__IMP ......
PHPÕ¾µãµÄÔÚÏ߽̳ÌÒѾºÜ°ôÁË¡£ÔÚÄÇÀﻹÓÐһЩÆäËû½Ì³ÌµÄÁ´½Ó¡£¶ø±¾Îĵĸò¿·Ö½«ÈÃÄã¶ÔPHPÊìϤһµã¡£ÎÒ²»¿ÉÄÜ×öµ½Ã»ÓÐÈκÎÒÅ©£¬ÎÒµÄÄ¿µÄÖ»ÔÚÓÚÄÜÈÃÄãѸËÙ¿ªÊ¼ÄãµÄPHP±à³Ì¡£
2.1 Ê×ÒªÌõ¼þ
ÄãÊ×ÏȱØÐëÒªÓÐÒ»¸öÕýÔÚ¹¤×÷×ŵÄÖ§³ÖPHPµÄweb·þÎñÆ÷¡£ÎÒ¼Ù¶¨ÔÚÄãµÄ·þÎñÆ÷ÉÏËùÓÐPHPÎļþµÄÀ©Õ¹ÃûΪ.php3¡£
2.2 PHPµÄ°²×°
Éú ......