PHPÁ¬½ÓSQL Server
ʹÓùýSQL ServerµÄÈËÓ¦¸Ã¶¼Çå³þ£¬SQL Server³£ÓõÄÓÐÁ½ÖÖÈÏÖ¤·½Ê½£¬Ò»ÖÖÊDZ¾µØϵͳÕË»§ÈÏÖ¤£¨Windows Authentication £©£¬Ò»ÖÖÊÇʹÓÃÓû§ÃûºÍÃÜÂ루SQL Server Authentication £©£¬µÚ¶þÖÖÈÏÖ¤·½Ê½±ØÐëÆôÓÃSQL ServerµÄ»ìºÏģʽ¡£
¡¡¡¡1.Windows AuthenticationÁ¬½Ó²¿·Ö´úÂë¶Î£º
<?php
$serverName = "(local)";
$connectionInfo = array("Database"=>"TestingInfo","ConnectionPooling"=>false);
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
echo "Á¬½Óʧ°Ü£¡";
die( print_r( sqlsrv_errors(), true));
}
?>
¡¡¡¡2.SQL Server AuthenticationÁ¬½Ó²¿·Ö´úÂë¶Î£º
<?php
$serverName = "(local)";
$uid = "sa";
$pwd = "******";
$connectionInfo = array("UID"=>$uid,"PWD"=>$pwd,"Database"=>"TestingInfo");
$conn = sqlsrv_connect( $serverName,$connectionInfo);
if( $conn == false)
{
echo "Á¬½Óʧ°Ü£¡";
die( print_r( sqlsrv_errors(), true));
}
?>
¡¡¡¡²Î¿¼¹Ù·½ÌṩµÄÓ¢ÎÄÔÎĵµ£¬Õë¶Ô²ÎÊý$connectionInfo×öÒ»¸ö¼òµ¥ËµÃ÷£¬ÒòΪ$connectionInfoÊÇÒ»¸öHash±í½á¹¹£¬Ï±߲ÎÊý¸ñʽΪ£º
Key[DataType]£º
Description(Default Value)£º¼ü[Êý¾ÝÀàÐÍ]£ºÃèÊö(ĬÈÏÖµ)
¡¾1¡¿APP[StringÀàÐÍ]£º
ʹÓõÄÓ¦ÓóÌÐòÃû³Æ¡¾*£ºÎÒ×Ô¼º²»Ì«¶®µÃÕâ¸öµØ·½µÄÒâÒ壬²»ºÃÒâ˼¡¿(ûÓÐĬÈÏÖµ)
¡¾2¡¿ConnectionPooling[1»òtrueΪ´ò¿ªÁ¬½Ó³Ø£¬0»òfalseΪ¹Ø±ÕÁ¬½Ó³Ø]£º
ÓÃÀ´ÉèÖÃÊÇ·ñ´ò¿ªSQL ServerµÄÁ¬½Ó³Ø¹¦ÄÜ(ĬÈÏֵΪtrue(1))
¡¾3¡¿Database[StringÀàÐÍ]£º
Á¬½ÓµÄÊý¾Ý¿âµÄÃû³Æ£¬ËùÓÐÁ¬½ÓÌṩµÄÊý¾Ý¿âÃû³ÆÀàËÆASP.NETÀïÃæweb.configµÄÁ¬½Ó×Ö·û´®ÀïÃæµÄÊý¾Ý¿âʵÀýÃû£¬Èç¹ûÉèÖÃÁËDatabaseµÄÁ¬½ÓÊôÐÔ£¬Çý¶¯»áĬÈÏʹÓÃSQL ServerÖ§³ÖµÄTransact-SQL½Å±¾À´²Ù×÷ËùÓÐÌṩµÄÊý¾Ý¿âʵÀý£¬°üÀ¨Ìí¼Ó¡¢É¾³ý¡¢²éѯ¡¢Ð޸ĵȸ÷ÖÖ²Ù×÷(ĬÈÏΪµÇ½µÄ²Ù×÷ϵͳÀïÃæµÄÊý¾Ý¿â£¬ÎÒûÓвâÊÔ¹ý£¬Ó¦¸ÃÊÇÖ±½ÓÔËÐгÌÐòµÄ(local))
¡¾4¡¿Encrypt[1»òtrueΪִÐмÓÃÜ£¬0»òfalseΪ²»Ö´ÐмÓÃÜ]£º
ÉèÖÃÊÇ·ñ¶Ô´«Èë·þÎñÆ÷µÄSQL½Å±¾Ö´ÐмÓÃܲÙ×÷£¬µ±È»Èç¹ûʹÓüÓÃܲÙ×÷»á¶ÔϵͳÐÔÄÜ´æÔÚÒ»¶¨Ó°Ï죬²»¹ýÓ°Ïì²»Ã÷ÏÔ(ĬÈÏΪfalse(0))
¡¾5¡¿Failover_Partner[StringÀàÐÍ]£º
Ìṩһ¸ö·þÎñÆ÷¾µÏñ£¬´ËÊôÐÔÓ¦¸ÃÊÇÓÃÓÚÖ÷·þÎñÆ÷DownµôµÄÇé¿ö
Ïà¹ØÎĵµ£º
PHP³ÌÐòºÍMySqlÊý¾ÝÂÒÂëÎÊÌâÔÒò¼°½â¾ö
ÂÒÂëÎÊÌâ¼òµ¥Ëµ¾ÍÊÇÊý¾Ý¿âдÈë¶ÁÈ¡£¬ÍøÒ³Îļþ£¬ÍøÒ³ÏÔʾʱ¼¸¸ö»·½ÚµÄ±àÂë²»Ò»ÖÂÔì³ÉµÄ¡£
ÂÒÂëÎÊÌâ
дÈëʱ£ºÒ³ÃæÌáȡдÈëÊý¾Ý±àÂëºÍдÈëÊý¾Ý¿âʱ±àÂë²»Ò»ÖÂ
¶Áȡʱ£º¶ÁÈ¡ºóËùÓñàÂëÓëÊý¾Ý¿âдÈëʱ²»Ò»ÖÂ
ÏÔʾʱ£º±àÂëÓëÊý¾Ý¿â¶ÁÈ¡ºóµÄÊý¾Ý²»Ò»ÖÂ
ºÜÏÔȻֻÓÐÈýÕ߶¼Í³Ò»²ÅÐУ ......
±¾½Ì³ÌÀ´½²Ò»Ï¹ØÓÚÔÚphp±à³ÌÖг£Óõ½µÄÑ»·Óï¾ädo whileÓëwhileµÄÇø±ð°É£¬while Êǵ±Ìõ¼þΪÕæÊDzÅÖ´Ðжødo whileÖÁÉÙ»áÖ´ÐÐһϣ¬ÏÂÃæÎÒÃǾÍÀ´¿´¿´
do {
}while(Ìõ¼þ)
¿´do whileµÄʵÀý°É¡£
<?
$a =10;
do {
echo $a;
}while ($a>11)
ÕâÀï»áÊä³ö10;È»ºóÑ»·ÖÕÖ¹£¬ÄÇôÎÒÃÇÀ´¿´¿´whileµÄʵÀý°É¡£
$a=10;
w ......
<?PHP
//====================================================
// FileName: snap.class.php
//   ......
<?php
//ʹÓÃfunction¹Ø¼ü×Ö¶¨Òå·½·¨
function num($value,$value2 = 'ÄúºÃ£¡'){
echo $value.$value2;
}
//µÚÒ»´Îµ÷ÓÃ
num("ÕÅÈý");
//µÚ¶þ´Îµ÷ÓÃ
//¿ÉÒÔ¿´³ö£¬¸Ã·½·¨¶¨Òåʱ£¬µÚ¶ ......
function htmldecode($str)
{
if(empty($str)) return;
if($str=="") return $str;
$str=str_replace("&",chr(34),$str);
$str=str_replace(">",">",$str);
$str=str_replace("<","<",$str);
$str=str_replace("&","&",$str);
$str=str_replace(" ",chr(32),$str);
$str=str_replace(" ", ......