Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[PHP]PearµÄʹÓÃ

1. PEARµÄ°²×°, ÕâÀï½éÉÜÀûÓÃPHP5×Ô´øµÄBATÎļþ°²×°£¬ÐèÒªÄÜÉÏÍø¡£
   a. ÔÚPHP5Ŀ¼ÏÂÕÒµ½go-pear.bat£¬Ë«»÷°²×°(±£Ö¤ÄÜÉÏÍø, ÒÔ±ãÏÂÔØ)£¬BAT×Ô¶¯´ÓÍøÉÏÏÂÔØPEARËùÐèµÄ¶«Î÷£»
   b. °´ÕÕÌáʾÊäÈëһЩÉèÖÃÐÅÏ¢£¬Ö÷ÒªÊÇÒª°Ñ¾ÖÓòÍøµÄÍø¹Ø¼ÓÉÏ£¬Èçhttp://192.168.0.1:80/ , pearÒªÓÃÕâ¸öµØÖ··ÃÎÊInternet£¬ÈôÎÞ´úÀí·þÎñÆ÷ÔòÖ±½Ó»Ø³µ
   c. È»ºó»áÌáʾһЩ°üºÍPHP°ó¶¨£¬Ñ¡ÔñY
2. °²×°ÍêPEARºó, ÒÔÏÂʾÀý¾ßÌåµ÷ÓÃ: 
<?php
require_once 'DB.php';
//$dsn = 'sqlite:///E:/web2/Web_TY/sqlite/data/tydb.db?mode=0666';
$dsn = array(
'phptype' => 'mysql',
'username' => 'root',
'password' => '666666',
'hostspec' => 'localhost',
'database' => 'MyDbName'
);
$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL
);
$db =& DB::connect($dsn, $options);
if (DB::isError($db)) {
die($db->getMessage());
}
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$res =& $db->query('select * from counter');
if (DB::isError($res)) {
die($res->getMessage());
}
printf("ÐÐΪ£º%d,ÁÐΪ£º%d<br>", $res->numRows(), $res->numCols());
?>
3. pearʹÓÃÓöµ½µÄÎÊÌâ
  a. ²âÊÔpear¶ÔSqliteµÄÖ§³Ö,°²×°¹ý³ÌÖз¢ÏÖ,ÀÏÊÇÌáʾphp_pdo.dllµÈÎÞ·¨¼ÓÔØ£¬µ¼ÖÂÎÞ·¨Ö§³ÖSqliteµÄÊý¾Ý²Ù×÷¡£¸ü»»ÐµÄphp°æ±¾ºó£¬¼ÓÔØ´íÎóûÓÐÁË£¡µ«ÔÚÐÞ¸Äphp.iniµÄinclude_pathºó£¨Ê¹Æä°üº¬smarty¿âµÄlibĿ¼£©£¬·¢ÏÖpear¿âµÄDB²Ù×÷ÓÖÎÞ·¨½øÐÐÁË¡£·¢ÏÖpear¿âµÄDBÁ¬½ÓÉèÖúÍphp.iniÖеÄinclude_pathÓйأ¬Èç¹û°üº¬ÆäËü·¾¶£¬½«µ¼ÖÂpear¿â²»ÄÜʹÓá£
  b. ²âÊÔʹÓÃSqlite Database¡£·¢ÏÖphpÎÞ·¨Ê¶±ðlite.db£¬»³ÒÉÊÇÓÉÓÚphpÖ§³ÖsqliteµÄ°æ±¾£¨2.8.2£©£¬±È±¾»úÆ÷µÄ°æ±¾£¨3.0.3£©µÍ£¬µ¼ÖÂÎÞ·¨Ê¶±ð¸Ãdb¡£


Ïà¹ØÎĵµ£º

PHPѧϰ±Ê¼Ç

1£ºint strposº¯ÊýµÄ×÷ÓúÍCÓïÑÔÖеÄchar *strstr()Ò»Ñù
2£ºhtmlspecialchars()£¬½«ÌØÊâ×Ö·ûת»¯ÎªHTMLʵÌå(entity)
3£ºPHPÖ÷ÒªÓÃÓÚÒÔÏÂÈý¸öÁìÓò£º
   1>£º·þÎñÆ÷¶Ë½Å±¾  2>£ºÃüÁîÐнű¾  3>£º±àд×ÀÃæÓ¦ÓóÌÐò
4£ºphp²¢ÖÃÔËËã·û(.)½«Á½¸ö×Ö·û´®Á¬½ÓÆðÀ´
5£ºphpµÄ×¢ÊͺÍCÓïÑÔµÄ×¢ÊÍÒ»Ñù¡ ......

PHP htmlspecialchars() º¯Êý


¶¨ÒåºÍÓ÷¨
htmlspecialchars() º¯Êý°ÑһЩԤ¶¨ÒåµÄ×Ö·ûת»»Îª HTML ʵÌå¡£
Ô¤¶¨ÒåµÄ×Ö·ûÊÇ£º
& £¨ºÍºÅ£© ³ÉΪ &amp;
" £¨Ë«ÒýºÅ£© ³ÉΪ &quot;
' £¨µ¥ÒýºÅ£© ³ÉΪ &#039;
< £¨Ð¡ÓÚ£© ³ÉΪ &lt;
> £¨´óÓÚ£© ³ÉΪ &gt;
Óï·¨
htmlspecialchars(string,quotestyle,character-se ......

PHPÓëMySQL¿ª·¢ÖеÄ×Ö·û±àÂëÎÊÌâ

Ò»£®¹ØÓÚMySQLÊý¾Ý¿â·þÎñÆ÷
MySQL·þÎñÆ÷µÄĬÈϱàÂëÊÇLatin1£¬²»Ö§³ÖÖÐÎÄ£¬ÄÇôÈçºÎÐÞ¸ÄMySQLµÄĬÈϱàÂëÄØ£¬ÏÂÃæÒÔUTF-8ΪÀýÀ´ËµÃ÷¡£
1¡¢ÖÐÖ¹MySQL·þÎñ£¨bin/mysqladmin -u root shutdown£©
2¡¢ÔÚ/etc/ÏÂÕÒµ½my.cnf£¬Èç¹ûûÓоͰÑMySQLµÄ°²×°Ä¿Â¼ÏµÄsupport-filesĿ¼ÏµÄmy-medium.cnf¸´ÖƵ½/etc/ϲ¢¸ÄÃûΪmy.cnf¼´¿É ......

phpÖе¥ÒýºÅºÍË«ÒýºÅÇø±ð

1 PHPÖе¥ÒýºÅÓëË«ÒýºÅµÄÇø±ð  
¡¡¡¡ÔÚPHPÖУ¬Í¨³£Ò»¸ö×Ö·û´®±»¶¨ÒåÔÚÒ»¶ÔÒýºÅÖУ¬È磺
'I am a string in single quotes'
"I am a string in double quotes"
¡¡¡¡PHPÓï·¨·ÖÎöÆ÷ÊÇÓóɶԵÄÒýºÅÀ´ÅжÏÒ»¸ö×Ö·û´®µÄ¡£Òò´Ë£¬ËùÓÐ×Ö·û´®±ØÐëʹÓÃͬһÖÖµ¥»òÕßË«
ÒýºÅÀ´¶¨Ò忪ʼºÍ½áÊø¡£ÀýÈ磬ÏÂÃæµÄ×Ö´®¶¨ÒåÊ ......

php±í¸ñ(test)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <style type = "text/css">
        &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ