ת×Ô±¾È˸öÈËÍøÕ¾ ¡¾PHP̽·Õß
¡¿£¬»¶Ó¸÷λ·ÃÎÊÕ¾µã£¡
ÔÚʹÓÃPHP»ñÈ¡ä¯ÀÀÆ÷ÐÅϢʱ£¬Í¨³£ÓÐÁ½ÖÖ·½Ê½£º
µÚÒ»ÖÖÊÇ£ºÊ¹ÓÃ$_SERVER[HTTP_USER_AGENT]Ñ¡Ïî
´Ë·½Ê½»ñÈ¡µÄÊǸñʽ²»¹æÔòµÄÊý¾Ý£¬Èç
Mozilla/4.0 (compatible; MSIE 8.0
; Windows NT 5.1; Trident/4.0; GTB6; CIBA; .NET CLR 2.0.50727)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.33
Safari/532.0
¾ßÌåä¯ÀÀÆ÷ÐͺÅÐèÒª×Ô¼º·ÖÎö²ÅÄÜ»ñÈ¡£¬·Ö±ðÊÇ IE8¡¢Firefox/3.5.5¡¢
Chrome/3.0¡£
µÚ¶þÖÖÊÇ£ºÊ¹ÓÃPHPµÄget_browser(£©º¯Êý
ÔÚʹÓô˺¯Êýʱ£¬Ò»°ã»áµÃµ½ÈçϾ¯¸æ
“Warning
: get_browser() [function.get-browser
]: browscap ini directive
not set. in …”
ͨ¹ý²é¿´PHPÊÖ²á¿ÉÒÔÖªµÀ£¬Õâ¸öº¯ÊýµÄʹÓÃÊÇÓÐÌõ¼þµÄ£º
Note
: In order for this to
work, your browscap configuration setting in php.ini
must point to
the correct location of the browscap.ini
file on your
system.
browscap.ini
is ......
ÔÚPHP½øÐÐÐòÁл¯Ê±£¬serialize() ¼ì²éÀàÖÐÊÇ·ñÓÐ __sleep() ,Èç¹ûÓУ¬Ôò¸Ãº¯Êý½«ÔÚÈκÎÐòÁл¯Ö®Ç°ÔËÐС£¸Ãº¯Êý±ØÐë·µ»ØÒ»¸öÐèÒª½øÐÐÐòÁл¯±£´æµÄ³ÉÔ±ÊôÐÔÊý×飬²¢ÇÒÖ»ÐòÁл¯¸Ãº¯Êý·µ»ØµÄÕâЩ³ÉÔ±ÊôÐÔ. ¸Ãº¯ÊýÓÐÁ½¸ö×÷ÓÃ: µÚÒ». ÔÚÐòÁл¯Ö®Ç°,¹Ø±Õ¶ÔÏó¿ÉÄܾßÓеÄÈκÎÊý¾Ý¿âÁ¬½ÓµÈ. µÚ¶þ. Ö¸¶¨¶ÔÏóÖÐÐèÒª±»ÐòÁл¯µÄ³ÉÔ±ÊôÐÔ,Èç¹ûij¸öÊôÐÔ±È½Ï´ó¶ø²»ÐèÒª´¢´æÏÂÀ´,¿ÉÒÔ²»°ÑËüд½ø__sleepÒª·µ»ØµÄÊý×éÖÐ,ÕâÑù¸ÃÊôÐԾͲ»»á±»ÐòÁл¯
Ïà·´µØ£¬unserialize() ´Ó×Ö½ÚÁ÷Öд´½¨ÁËÒ»¸ö¶ÔÏóÖ®ºó,ÂíÉϼì²éÊÇ·ñ¾ßÓÐ__wakeup µÄº¯ÊýµÄ´æÔÚ¡£Èç¹û´æÔÚ£¬__wakeup Á¢¿Ì±»µ÷Óá£Ê¹Óà __wakeup µÄÄ¿µÄÊÇÖØ½¨ÔÚÐòÁл¯ÖпÉÄܶªÊ§µÄÈκÎÊý¾Ý¿âÁ¬½ÓÒÔ¼°´¦ÀíÆäËüÖØÐ³õʼ»¯µÄÈÎÎñ¡£
<?php
class User
{
public $name;
public $id;
function __construct()
{
$this->id = uniqid();   ......
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
. ......
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
. ......
javaÉÏ´«Îļþ
ÐèÒªµÄµÚÈý·½jar°üÓУ¨ÕâÀïʹÓÃapacheµÄ£©
apacheµÄcommons-fileupload£¨ÉÏ´«Óã©£¬commons-io £¨listenerÇåÀíÀàÓã© £¬ commons-beanutils£¨¿ÉÑ¡£©
¾ßÌå²Ù×÷
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
if(ServletFileUpload.isMultipartContent(request)) { //ÅжÏÇëÇóÀàÐÍÊDz»ÊÇmultipart
try {
List<FileItem> fileList = upload.parseRequest(request);
for(FileItem item : fileList) {
if(!item.isFormField()) { //ÅжÏÊDz»ÊÇÎļþ±íµ¥
String filename = item.getName();
String ext = filename.substring(filename.indexOf(".") + 1);
if(!"dic".equalsIgnoreCase(ext)) {
out.println("file type must be .dic");
} else {
File uploadedFile = new File(path + "/" + filename);
item.write(uploadedFile); //±£´æ
out.println("upload ok");
}
}
}
} catch (FileUploadException e) {
e.printStackTrace();
} catch (Exc ......
javaÉÏ´«Îļþ
ÐèÒªµÄµÚÈý·½jar°üÓУ¨ÕâÀïʹÓÃapacheµÄ£©
apacheµÄcommons-fileupload£¨ÉÏ´«Óã©£¬commons-io £¨listenerÇåÀíÀàÓã© £¬ commons-beanutils£¨¿ÉÑ¡£©
¾ßÌå²Ù×÷
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
if(ServletFileUpload.isMultipartContent(request)) { //ÅжÏÇëÇóÀàÐÍÊDz»ÊÇmultipart
try {
List<FileItem> fileList = upload.parseRequest(request);
for(FileItem item : fileList) {
if(!item.isFormField()) { //ÅжÏÊDz»ÊÇÎļþ±íµ¥
String filename = item.getName();
String ext = filename.substring(filename.indexOf(".") + 1);
if(!"dic".equalsIgnoreCase(ext)) {
out.println("file type must be .dic");
} else {
File uploadedFile = new File(path + "/" + filename);
item.write(uploadedFile); //±£´æ
out.println("upload ok");
}
}
}
} catch (FileUploadException e) {
e.printStackTrace();
} catch (Exc ......
¾¡Á¿Ê¹Óõ¥ÒýºÅ¶ø²»ÊÇË«ÒýºÅ¡£
¾¡Á¿Ê¹ÓôøÌõ¼þµÄinclude¶ø²»ÊÇrequire¡£
¾¡Á¿Ê¹ÓÃecho¶ø²»ÊÇprint¡£
¾¡Á¿Ê¹ÓÃÄÚǶµÄHTML¶ø²»ÊÇecho¡£
¾¡Á¿Ê¹ÓÃstr£replace()¶ø²»ÊÇereg£replace()¡£
¾¡Á¿sql²»ÓÃÁªºÏ²éѯ¡£
......
strtotimeº¯ÊýÊÇÒ»¸öºÜºÃµÄº¯Êý,Áé»îµÄÔËÓÃËü,»á¸øÄãµÄ¹¤×÷´øÀ´²»ÉÙ·½±ã.µ«PHPµÄÊÖ²áÖÐÈ´¶Ô´Ëº¯ÊýµÄ²ÎÊýû×÷Ì«¶à½éÉÜ,¶ÔЩº¯ÊýµÄÆäËû½éÉÜÒ²·Ç³£ÉÙ¡£
ÏÈ¿´ÊÖ²á½éÉÜ£º
strtotime — ½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ Unix ʱ¼ä´Á
¸ñʽ£ºint strtotime ( string $time [, int $now ] )
¡¡¡¡±¾º¯ÊýÔ¤ÆÚ½ÓÊÜÒ»¸ö°üº¬ÃÀ¹úÓ¢ÓïÈÕÆÚ¸ñʽµÄ×Ö·û´®²¢³¢ÊÔ½«Æä½âÎöΪ Unix ʱ¼ä´Á£¨×Ô January 1 1970 00:00:00 GMT ÆðµÄÃëÊý£©£¬ÆäÖµÏà¶ÔÓÚ now ²ÎÊý¸ø³öµÄʱ¼ä£¬Èç¹ûûÓÐÌṩ´Ë²ÎÊýÔòÓÃϵͳµ±Ç°Ê±¼ä¡£
¡¡¡¡±¾º¯Êý½«Ê¹Óà TZ »·¾³±äÁ¿£¨Èç¹ûÓеϰ£©À´¼ÆËãʱ¼ä´Á¡£×Ô PHP 5.1.0 ÆðÓиüÈÝÒ׵ķ½·¨À´¶¨ÒåÊ±ÇøÓÃÓÚËùÓеÄÈÕÆÚ£¯Ê±¼äº¯Êý¡£´Ë¹ý³ÌÔÚ date_default_timezone_get() º¯ÊýÒ³ÃæÖÐÓÐ˵Ã÷¡£
Note : Èç¹û¸ø¶¨µÄÄê·ÝÊÇÁ½Î»Êý×ֵĸñʽ£¬ÔòÆäÖµ 0-69 ±íʾ 2000-2069£¬70-100 ±íʾ 1970-2000¡£
²ÎÊý
time
±»½âÎöµÄ×Ö·û´®£¬¸ñʽ¸ù¾Ý GNU » ÈÕÆÚÊäÈë¸ñʽ µÄÓï·¨¡£ÔÚ PHP 5.0 ֮ǰ£¬time Öв»ÔÊÐíÓкÁÃëÊý£¬×Ô PHP 5.0 Æð¿ÉÒÔÓе«ÊǻᱻºöÂÔµô¡£
now
ÓÃÀ´¼ÆËã·µ»ØÖµµÄʱ¼ä´Á¡£ ¸Ã²ÎÊýĬÈÏÖµÊǵ±Ç°Ê±¼ätime(),Ò²¿ÉÒÔÉèÖÃΪÆäËûʱ¼äµÄʱ¼ä´Á£¨ÎÒÒ»Ö±ºöÂÔµÄÒ»¸ö¹¦Ä ......