9.3 ͨ¹ýPHP²Ù×÷AccessÊý¾Ý¿â
9.3 ͨ¹ýPHP²Ù×÷AccessÊý¾Ý¿â
9.3.1 Á¬½ÓAccessÊý¾Ý¿â
ÔÚPHPÖÐÁ¬½ÓAccessÓÐÈçÏÂ3ÖÖ·½Ê½¡£
£¨1£©´´½¨ÏµÍ³Êý¾ÝÔ´£¬ÓÃPHPÌṩµÄODBCº¯Êý
¼´¿É¡£
£¨2£©Í¬Ñù¿ÉÒÔʹÓÃPHPµÄODBCº¯Êý£¬µ«²»´´½¨
Êý¾ÝÔ´¡£¿ª·ÅÊý¾Ý¿âÁ¬½Ó£¨Open DateBase
Conection£¬ODBC£©ÊÇWindows Open
Server£¨¿ª·Å·þÎñ£©API£¨WOSA£©²úÆ·Ö®Ò»¡£Ò»¸öÊý¾ÝÔ´ÊǶÔÊý¾Ý¿âµÄÒ»¸öÃüÃûÁ¬½Ó¡£¶ÔÓÚÓ¦ÓóÌÐòÒªÁ¬½ÓµÄ²»Í¬ÀàÐ͵ÄÊý¾Ý¿â£¬¶¼ÐèÒªÒ»¸öODBC
Çý¶¯³ÌÐò¡£ODBC
APIÖ÷ÒªÊÇΪ¿Í»§/·þÎñÆ÷µÄRDBMSʹÓÃÉè¼ÆµÄ£¬µ«ÊÇODBCÇý¶¯³ÌÐòÒ²¿ÉÒÔÓÃÓÚÁ¬½Ó×ÀÃæÊý¾Ý¿âÎļþ¡¢¹¤×÷±íºÍƽÃæÎļþ¡£ODBCʹÓÃ
Odbcinst.dll¿âÀ´ÉèÖúÍÇå³ýÊý¾ÝÔ´¡£Odbcad32.exeÊÇÒ»¸öÓÃÓÚ½¨Á¢ODBCÊý¾ÝÔ´µÄ¶ÀÁ¢µÄ32λ¿ÉÖ´ÐÐÓ¦ÓóÌÐò£¬ÔÚ¿ØÖÆÃæ°åÖÐÓÐÆä
¶ÔÓ¦µÄͼ±êControl
Panel¡£
ODBCÇý¶¯¹ÜÀí³ÌÐòΪÊý¾ÝÔ´´ò¿ªODBCÇý¶¯³ÌÐò
²¢½«SQLÓï¾ä´«Ë͸øÇý¶¯³ÌÐò¡£ÔÚ¿Í»§/·þÎñÆ÷RDBMS´¦ÀíÍêÒ»¸öselect²éѯºó£¬ODBCÇý¶¯³ÌÐò½«Öµ·µ»Ø¸øÓ¦ÓóÌÐò¡£µ±Ö´ÐÐÒ»¸öinsert¡¢
update»òdeleteÓï¾äʱ£¬Çý¶¯³ÌÐò·µ»Ø²éѯËùÓ°ÏìµÄÐÐÊý¡£
ÏÂÃæ½éÉÜPHPʹÓÃODBCÁ¬½ÓAccessÊý
¾Ý¿âµÄ·½·¨¡£ÓÃ$connstr="DRIVER= Microsoft Access Driver
(*.mdb)À´ÉèÖÃÊý¾ÝÇý¶¯£¬º¯Êýrealpath()ÓÃÀ´È¡µÃÊý¾Ý¿âµÄÏà¶Ô·¾¶¡£ÀûÓø÷½·¨Á¬½ÓAccessÊý¾Ý¿âÖ÷ÒªÓ¦Óõ½PHPµÄ
odbc_connect()º¯Êý£¬¸Ãº¯ÊýÉùÃ÷ÈçÏ£º
resourse odbc_connect( string dsn, string user,
string password [, int cursor_type])
dsn£ºÏµÍ³dsnÃû³Æ¡£
user£ºÊý¾Ý¿â·þÎñÆ÷ijÓû§Ãû¡£
password£ºÊý¾Ý¿â·þÎñÆ÷ijÓû§ÃÜÂë¡£
cursor_type£ºÓαêÀàÐÍ¡£
´úÂëÈçÏ£º
$connstr="DRIVER=Microsoft Access Driver
(*.mdb);
DBQ=".realpath("bookinfo.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC
);
£¨3£©Ê¹ÓÃ΢ÈíµÄADODBÊý¾Ý¿âÇý¶¯¡£
ActiveX Data Objects£¨ADO£©ÊÇMicrosoft¿ª·ÅÊý¾Ý¿âÓ¦ÓóÌÐòµÄÊý¾Ý¿â·ÃÎʼ¼Êõ¡£Ëü±»Éè¼ÆÓÃÀ´Í¬ÐµÄÊý¾Ý·ÃÎʲãOLE
DB ProviderÒ»ÆðÐͬ¹¤×÷£¬ÌṩͨÓÃÊý¾Ý·ÃÎÊ£¨Universal Date Access£©¡£OLE
DBÊÇÒ»¸öµÍ²ãµÄÊý¾Ý·ÃÎʽӿڣ¬ÓÃËü¿ÉÒÔ·ÃÎʸ÷ÖÖÊý¾ÝÔ´£¬°üÀ¨´«Í³µÄ¹ØϵÐÍÊý¾Ý¿â¡¢µç×ÓÓʼþϵͳ¼°×Ô¶¨ÒåµÄÉÌÒµ¶ÔÏó¡£ADO¼¼Êõ´ó´ó¼ò»¯ÁËOLE
DBµÄ²Ù×÷£¬ÒòΪADO·â×°ÁËOLE
DB³ÌÐòÖÐʹÓõĴóÁ¿COM½Ó¿Ú£¬ËùÒÔADOÊÇÒ»Öָ߲ãµÄ·ÃÎʼ¼Êõ¡£
ADO¼¼Êõ»ùÓÚͨÓöÔÏóÄ£ÐÍ£¨COM£©£¬ËüÌṩÁ˶à
ÖÖÓïÑ
Ïà¹ØÎĵµ£º
<?php
$start = ip2long('192.168.1.1');
$start = sprintf("%u", $start) ;
$end = ip2long('192.168.1.50');
$end = sprintf("%u", $end) ;
for ($start; $start<$end; $start++){
echo long2ip($start)."<br>";
}
?> ......
/**
* »ñµÃµ±Ç°Ê±¼äµÄºÁÃëÊý£¬Óû§¼ì²âÒ³ÃæµÄÖ´ÐÐʱ¼ä
*
* @author cjz
* @date Thu Apr 09 15:05:55 CST 2009
*
* @return float(ºÁÃëÊý)
*/
function myGetMicrotime()
{
list($usec,$sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
......
GD¿âÊÇPHP½øÐÐͼÏó²Ù×÷Ò»¸öºÜÇ¿´óµÄ¿â¡£
ÏÈÔÚphp.iniÀïÔö¼ÓÒ»ÐÐÒýÓãºextension=php_gd2.dll
ÖØÆôapache¡£×öÒ»¸ö²âÊÔÒ³ var_dump(gd_info());Êä³öÊý¾Ý±íÃ÷GD¿âÒýÓóɹ¦¡£
±íµ¥auth.html
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
< ......
½ñÌìÅöµ½¸öÆæ¹ÖµÄÎÊÌ⣬һ¸öajaxÒ³ÃæÔÚ±¾µØ²âÊÔ·þÎñÆ÷ÔËÐÐÒ»ÇÐÕý³££¬´«µ½¹«Íø·þÎñÆ÷ÉϾÍËÀ»î˵ javascript´íÎó¡£
´ò¿ª´úÂëÒ»¿´£¬ÊÇjavascriptµÄÄÇÒ»ÐÐʹÓÃÁËÒ»¸öjsonµÄreponseText£¬DEBUGһϣ¬ÔÀ´»Ø´«Êǿյġ£
¿´¿´ºǫ́PHP£¬Ã²ËÆûʲôÎÊÌ⣨±¾À´ÒÔΪÊÇURLÎÊÌ⣩ȻºóÉÏÍøËÑһϣ¬ÔÀ´ÊÇPHPµÄjson_encodeº¯ÊýÔÚ5.2ϲÅÓÐ ......
Ò»¡¢»º´æ¼¼Êõ:
ÓÐЩÐÅÏ¢±È·½¾³£²»±äµÄ,µ«ÊÇ»¹ÊÇÄܱäµÄÐÅÏ¢·ÅÔÚ»º´æÖÐÒÔ¼Ó¿ìÏÔʾËÙ¶È,ÕâÊǺÜÓмÛÖµµÄ,ËùνµÄ»º´æ,ͨË×µÄÀí½â¾ÍÊÇһЩ±£´æÔÚ·þÎñÆ÷¶ËµÄ¹²ÓÃÐÅÏ¢.ËüÊÇÓÚ·þÎñÆ÷ͬÉúËÀµÄ,ÎÒÃÇÔÚ±£´æ»º´æµÄʱºò¿ÉÒÔÖ¸¶¨Ï´θüеÄʱ¼äµÄÅжÏ,±È·½ÒªÔÚ5·ÖÖÓ¸üÐÂÒ»´Î,¿ÉÒԼǼÉϴθüеÄʱ¼ä,ºÍµ±Ç°Ê±¼ä±È½Ï, ......