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²ËÄñ£¬Èç¹ûÄ㣺
1. ²»»áÀûÓÃÈçphpDoc
ÕâÑùµÄ¹¤¾ßÀ´Ç¡µ±µØ×¢ÊÍÄãµÄ´úÂë
2. ¶ÔÓÅÐãµÄ¼¯³É¿ª·¢»·¾³ÈçZend Studio
»òEclipse PDT
ÊÓ¶ø²»¼û
3. ´ÓδÓùýÈκÎÐÎʽµÄ°æ±¾¿ØÖÆϵͳ£¬ÈçSubclipse
4. ²»²ÉÓÃijÖÖ±àÂëÓëÃüÃû±ê×¼
£¬ÒÔ¼°Í¨ÓÃÔ¼¶¨£¬²»ÄÜÔÚÏîÄ¿¿ª·¢ÖÜÆÚÀï¹á³¹Âäʵ
5. ²»Ê¹ÓÃͳһ¿ª·¢·½Ê½
6. ²»×ª ......
½ñÌìȷʵÊÇÎÞÁÄÁË£¬Ð´ÁËÒ»¸ö±¸·ÝÈËÈËÍøµÄÈÕÖ¾£¬µ½±¾µØhtmlµÄÀà¡£
Ö÷ÒªÊÇcURLµÇ¼£¬ÕýÔò½âÎöÒ³Ãæ¡£
ʹÓ÷½·¨£¬×îºóÄǸö½Å±¾µÄ×îºóÁ½Ðиĵô£¬ÄãÖªµÀµÄ¡£»òÕßÖØÐÂдһ¸öÔËÐнű¾£º
<?php
include("renren.php");
$test = new renren("ÄãµÄÈËÈËÍøÕ˺Å","ÄãµÄÈËÈËÍøÃÜÂë");
$test->do ......
ÔÚphpÖз¢ËÍÓʼþ¿ÉÒÔÓÃ×Ô´øµÄmail()º¯Êý£¬µ«ÊÇÕâ¸öº¯Êý²»×ãµãºÜÃ÷ÏÔ£¬×îÖ÷ÒªÊÇÔÛ±¾»úÉÏûÓа²×°smtp·þÎñ¾Íû·¨Ê¹ÓÃmail()¡£
µ±È»ÏÖÔÚ»¹ÓÐphpÆäËûµÄ²å¼þ¡¢ÀàʲôµÄ£¬ÄÇЩҲÐí¹¦ÄÜÆëÈ«£¬¿ÉÊÇÍâ¼Ó¾Í¸Ð¾õ²»Ë¬¡£
ÄÇÆäËû°ì·¨µÄ»°£¬Ò»°ã»áÏ뵽ͨ¹ýSMTP·þÎñÆ÷À´·¢ËÍÓʼþ£¬µ«ÊÇÒ²»á²úÉúһϵÁÐÎÊÌ⣨¾ßÌåÓÐÄÄЩÎÊÌâ¿É¼û²Î¿¼×ÊÁÏ"ÎÞÐ ......
1¡¢¹ýÂ˱êÇ©(HTML)£ºstrip_tags()
ÀýÈ磺
<?php
$text = '<?php ?><p>Test paragraph.</p><!-- Comment -
-> <a href=http://topic.csdn.net/u/20090311/09/"#fragment">Other text</a>';
echo strip_tags($text);
echo "\n";
// ÔÊÐíʹÓÃ<p>ºÍ<a>
echo stri ......
<?php
/**
»ñÈ¡»úÆ÷Íø¿¨µÄÎïÀí£¨MAC£©µØÖ·
wwa $Exp
**/
class GetMacAddr
{
var $return_array = array(); // ·µ»Ø´øÓÐMACµØÖ·µÄ×Ö´®Êý×é
......