PHP½«Í¼Æ¬´æÈëMYSQL
ÍêÕûµÄʵÏÖÁËPHP½«Í¼Æ¬´æÈëMYSQL
Ç°Ì᣺
1 Ê×ÏȱØÐëÓµÓÐPHPµÄÔËÐл·¾³£¬ÁíÍ⻹µÃÓÐMYSQLÊý¾Ý¿â
2 Èç¹ûÎļþ²»ÄÜÉÏ´«³É¹¦Çë¼ì²épicsÊÇ·ñÊÇ¿ÉдµÄȨÏÞ
Ê×ÏÈÏÈ°Ñpic2db.rarÎļþ½âѹµ½PHP¿ÉÒÔÔËÐÐĿ¼Ï¡£
Æä´ÎÔÚMYSQLÖн¨Á¢Ò»¸öÊý¾Ý¿â:pic2db,È»ºóÔÚ¸ÃÊý¾Ý¿âϽ¨Á¢Ò»¸ö±í£¬±í½á¹¹Îª£º
CREATE TABLE `pic` (
`pic_id` int(11) NOT NULL auto_increment,
`pic_userid` int(11) NOT NULL,
`pic_content` longblob NOT NULL,
PRIMARY KEY (`pic_id`)
)
ÔÙ½Ó×ÅÐÞ¸Äcommon_db.phpÖеÄÊý¾Ý¿âÁ¬½ÓµÄÓû§ÃûºÍÃÜÂ룬¸ù¾ÝÄãMYSQLÉèÖõÄÀ´
×îºóÔËÐÐupload.phpÎļþ½øÐÐÉÏ´«£¬¶ødisplay_all.phpÊÇÏÔʾÊý¾Ý¿âÖÐËùÓеÄͼƬ
ͼƬÉÏ´«upload.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÉÏ´«</title>
</head>
<body>
<form action="post_action.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p> </p>
<p>
<label></label>
<label>
<input type="file" name="file" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="Ìá½»" />
</label>
</p>
<p> </p>
</form>
</body>
</html>
Á¬½ÓÊý¾Ý¿âµÄcommon_db.php:
<?php
/**
* Á¬½ÓÊý¾Ý¿âµÄº¯Êý
* Á¬½Ó³É¹¦½«»á·µ»ØÒ»¸öÁ¬½Ó×ÊÔ´
* @return mix
*/
function getLink() {
$link = mysql_connect("localhost","root","") or die("Êý¾Ý¿â·þÎñÆ÷Á¬½Óʧ°Ü!");
if(!mysql_select_db("crm",$link)) die("Êý¾Ý¿âÁ¬½Óʧ°Ü!");
return $link;
}
?>
´¦ÀíÉÏ´«µÄpost_action.php:
<?php
/**
* ±¾ÎļþÊǽ«Í¼Æ¬ÎļþÉÏ´«µ½·þÎñÆ÷¶Ë
* ²¢ÇÒ¶ÁÈ¡¸ÃÎļþµÄ¶þ½øÖÆÄÚÈÝ´æÈëµ½MYSQLµÄ
* pic±íÖÐlongblob×Ö¶Î
*
*/
//Ç¿ÖÆÒ³ÃæʹÓÃgb2312±àÂë
header("Content-Type: text/
Ïà¹ØÎĵµ£º
PHP±¾ÉíÊÇÓÐÒ»¸ö¶àάÊý×éÅÅÐòµÄº¯ÊýµÄ¡£
bool
array_multisort
( array
$ar1
[, mixed
$arg
[, mixed
$...
[, array
$...
]]] )
ÏÂÃæÊÇÊֲᵱÖжÔÓÚarray_multisortº¯ÊýµÄÃèÊö£º
array_multisort() ¿ÉÒÔÓÃÀ´Ò»´Î¶Ô¶à¸öÊý×é½øÐÐÅÅÐò£¬»òÕ߸ù¾Ýijһά»ò¶àά¶Ô¶àάÊý×é½øÐÐÅÅÐò¡£
¹ØÁª£¨string ......
½ñÌìÔÚÊý¾Ý¿âÖвåÈëÁËÖÐÎÄ£¬·¢ÏÖÓеÄÊÇÂÒÂ룬ÓеIJ»ÊÇ£¬ºÜÊÇÄÉÃÆ¡£
×îºóÕÒµ½Á˽â¾ö°ì·¨£º
´ò¿ª /etc/mysql/my.cnf
ÔÚ£Ûmysqld]ºÍ£Ûclient]½ÚÏ·ֱðÌí¼Ó:
default-character-set = utf8
È»ºóÖØÐÂÆô¶¯mysql£¬ÐèҪעÒâµÄÊÇ£¬¶ÔÐÞ¸ÄÒÔÇ°´´½¨µÄÊý¾Ý¿âÀ´Ëµ£¬ËûµÄ×Ö·û¼¯»¹ÊÇÔÀ´µÄ£¬ËùÒÔ»¹ÊÇ»á³öÏÖÂÒÂí£¬¶øд´½¨µÄÊý¾Ý ......
1£¬Äê-ÔÂ-ÈÕ
echo date('Y-m-j');
2007-02-6
echo date('y-n-j');
07-2-6
´óдY±íʾÄêËÄλÊý×Ö£¬¶øСдy±íʾÄêµÄÁ½Î»Êý×Ö£»
Сдm±íʾÔ·ݵÄÊý×Ö(´øÇ°µ¼)£¬¶øСдnÔò±íʾ²»´øÇ°µ¼µÄÔ·ÝÊý×Ö¡£
echo date('Y-M-j');
2007-Feb-6
echo date('Y-m-d');
2007-02-06
´óдM±íʾÔ·ݵÄ3¸öËõд×Ö·û£¬¶øСдmÔò±íÊ¾Ô ......
PHPÕ¾µãµÄÔÚÏ߽̳ÌÒѾºÜ°ôÁË¡£ÔÚÄÇÀﻹÓÐһЩÆäËû½Ì³ÌµÄÁ´½Ó¡£¶ø±¾Îĵĸò¿·Ö½«ÈÃÄã¶ÔPHPÊìϤһµã¡£ÎÒ²»¿ÉÄÜ×öµ½Ã»ÓÐÈκÎÒÅ©£¬ÎÒµÄÄ¿µÄÖ»ÔÚÓÚÄÜÈÃÄãѸËÙ¿ªÊ¼ÄãµÄPHP±à³Ì¡£
2.1 Ê×ÒªÌõ¼þ
ÄãÊ×ÏȱØÐëÒªÓÐÒ»¸öÕýÔÚ¹¤×÷×ŵÄÖ§³ÖPHPµÄweb·þÎñÆ÷¡£ÎÒ¼Ù¶¨ÔÚÄãµÄ·þÎñÆ÷ÉÏËùÓÐPHPÎļþµÄÀ©Õ¹ÃûΪ.php3¡£
2.2 PHPµÄ°²×°
Éú ......
ÍøÉϵÄͼƬÉÏ´«ºÜÉÙ£¬Òª²»¾ÍÊÇÀÏÍâµÄ¶«Î÷£¡
ÓÃ×Å×ܸоõ²»Ë¬~~ÓÚÊÇ×Ô¼º×öÁËÒ»¸ö£¡Ä¿Ç°»ù±¾ÉϹ¦ÄÜÒѾÍê³É¡£ÍêÈ«¹ú²ú¹þ¹þ
ÇëÖ§³Ö¹ú»õ£¡
Éϼ¸¸öͼ£º
Ö÷ÒªÌصã½éÉÜһϣº
1.³ÌÐòÓÅ»¯ ÔÚ1.0°æ±¾»ù´¡ÉÏÓÅ»¯Á˳ÌÐò
2.ÐÞÕýÉÏ´«Ê±ºò¹ö¶¯ÌõBUG
3.¿ÉÖظ´Ìí¼ÓÁÐ±í ²»Öظ´Ìí¼ÓÒÑÓÐͼƬ
4.¿ÉÇå¿ÕͼƬÁÐ±í£¬Ò²¿Éµ¥ÕÅͼƬɾ³ý
5.Ìå ......