SQLite Tutorial in PHP
SQLite Tutorial in PHP
SQLite is an SQL database manager used locally or on a website, and compatible
in particularly with PHP.
Summary
Installing SQLite and creating a database
.
Installing SQLite. Verifying the installation by creating a base.
Creating and using a SQLite table
.
Creating a table. Deleting a table. Adding a record. Reading a record.
How to find and update a post
.
Filling a database. Dump of the whole base. Finding a record by ID. Searching a post. Updating a post.
Download
The complete source code of the scripts
in a ZIP archive.
More
SQLite and multi-users. How to treat concurrency issue with SQLite
.
Ïà¹ØÎĵµ£º
1¡¢°²×°libeven
memcachedµÄʹÓÃÐèÒªlibevenµÄÖ§³Ö£¬ÎÒÃǵÃÏÈ×°ÉÏlibeven¡£
¹Ù·½ÍøÕ¾£ºhttp://www.monkey.org/~provos/libevent/
libevent°²×°·½Ê½±È½Ï¼òµ¥:
./configure && make
make install
¼ì²éÊÇ·ñ ÒѾ°²×°
ls -l /usr/local/lib/ | grep even
2¡¢°²×°memcached
¹Ù·½ÍøÕ¾£ºhttp://ww ......
1.Ö±½ÓʹÓÃmysql_insert_id()»ñÈ¡ÉÏÒ»´Î²åÈëµÄÊý¾ÝµÄAUTO_INCREMENTµÄ±äÁ¿µÄ±àºÅ£¬±ÈʹÓÃmysqlÓï¾ä»ñÈ¡·½±ã¼«¶à¡£µ«×¢ÒâÒªÔÚquery()ºóÁ¢¿ÌʹÓ㬱£Ö¤Ê±¼äÕýÈ·ÐÔ£¬Èç¶àÏ̷߳ÃÎÊÊý¾Ý¿âÊDzúÉúÎó²î¡£
2.µÈºÅ×óÓÒ¸÷ÁôÒ»¿Õ¸ñ£¬ÇåÎú±ãÓÚÔĶÁ¡£
3.PHPÖУ¬µ¥Ë«ÒýºÅ¾ù¿ÉÒÔÌ×string£¬Çø±ðÔÚÓÚ£º
"this is a simple $test" = 'this i ......
ƽʱÓà htmlspecialchars() À´¹ýÂËhtml, µ«ÊÇ°ÑhtmlµÄ×Ö·ûתÒåÁË,×îºóÏÔʾ³öÀ´µÄ¾ÍÊÇhtmlÔ´´úÂë, ÀûÓÃstrip_tags()¾Í¿ÉÒÔ°Ñhtml±êÇ©È¥³ýµô.
[php]
$str = 'harryxu
‘;
echo(htmlspecialchars($str) . ‘
‘);
echo(strip_tags($str));
// output:
// harryxu
// harryxu
?>
......
Õâ¶Îʱ¼äÔÚ¿´¡¶PHPºÍMySQL Web¿ª·¢¡·Ò»Êé¿´µ½str_replace½²½â£¬Ò»¶ÎСÌáʾдµ½£º¿ÉÒÔΪstr_replaceµÄÈý¸ö¶¼Ê¹ÓÃÊý×é´«È룬µ«½²½â±È½Ï¼òµ¥£¬ÓÚÊǾö¶¨×Ô¼ºµÄÊÔÑéһϸú¯ÊýÔÚ¸÷¸ö²ÎÊý´«ÈëÊý×éʱµÄÖ´Ðнá¹û¡£
º¯ÊýÔÐÍ£ºmixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
needle£ ......
ÔÚPHPÖÐʹÓùýSESSIONµÄÅóÓÑ¿ÉÄÜ»áÅöµ½Õâôһ¸öÎÊÌ⣬SESSION±äÁ¿²»ÄÜ¿çÒ³´«µÝ¡£ÕâÁîÎÒ¿àÄÕÁ˺ÃЩÈÕ×Ó£¬×îÖÕͨ¹ý²é×ÊÁÏ˼¿¼²¢½â¾öÁËÕâ¸öÎÊÌâ¡£ÎÒÈÏΪ£¬³öÏÖÕâ¸öÎÊÌâµÄÔÒòÓÐÒÔϼ¸µã£º
1¡¢¿Í»§¶Ë½ûÓÃÁËcookie
2¡¢ä¯ÀÀÆ÷³öÏÖÎÊÌ⣬ÔÝʱÎÞ·¨´æÈ¡cookie
3¡¢php.iniÖеÄsession.use_trans_sid = 0»òÕß±àÒëʱûÓдò¿ª--enable ......