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

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/


Ïà¹ØÎĵµ£º

linux mysql ÂÒÂëÎÊÌâ

 ½ñÌìÔÚÊý¾Ý¿âÖвåÈëÁËÖÐÎÄ£¬·¢ÏÖÓеÄÊÇÂÒÂ룬ÓеIJ»ÊÇ£¬ºÜÊÇÄÉÃÆ¡£
×îºóÕÒµ½Á˽â¾ö°ì·¨£º
´ò¿ª /etc/mysql/my.cnf
ÔÚ£Ûmysqld]ºÍ£Ûclient]½ÚÏ·ֱðÌí¼Ó:
default-character-set = utf8
È»ºóÖØÐÂÆô¶¯mysql£¬ÐèҪעÒâµÄÊÇ£¬¶ÔÐÞ¸ÄÒÔÇ°´´½¨µÄÊý¾Ý¿âÀ´Ëµ£¬ËûµÄ×Ö·û¼¯»¹ÊÇÔ­À´µÄ£¬ËùÒÔ»¹ÊÇ»á³öÏÖÂÒÂí£¬¶øд´½¨µÄÊý¾Ý ......

PHPµÄÈÕÆÚʱ¼äº¯Êýdate()

 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ÊìϤһµã¡£ÎÒ²»¿ÉÄÜ×öµ½Ã»ÓÐÈκÎÒÅ©£¬ÎÒµÄÄ¿µÄÖ»ÔÚÓÚÄÜÈÃÄãѸËÙ¿ªÊ¼ÄãµÄPHP±à³Ì¡£
2.1 Ê×ÒªÌõ¼þ
ÄãÊ×ÏȱØÐëÒªÓÐÒ»¸öÕýÔÚ¹¤×÷×ŵÄÖ§³ÖPHPµÄweb·þÎñÆ÷¡£ÎÒ¼Ù¶¨ÔÚÄãµÄ·þÎñÆ÷ÉÏËùÓÐPHPÎļþµÄÀ©Õ¹ÃûΪ.php3¡£
2.2 PHPµÄ°²×°
Éú ......

PHP£¬Ìæ»»¶à¸öÎļþÖеÄÎı¾

ÐèÇó£º
    ÐèÒª¶ÔÁ½¸öĿ¼ÖеÄÎļþÄÚÈݽøÐвéÕÒÌæ»»£¬Á½¸öĿ¼²éÕÒÌæ»»µÄÄÚÈݲ»Ò»Ñù¡£
    ÊµÏÖÖÐ×¢Ò⼸µã£º
    £¨1£©º¯ÊýµÝ¹éµ÷Óã¬À´¼ìË÷×ÓĿ¼£»
    £¨2£©º¯ÊýÃû¿ÉÒÔÒÔ²ÎÊýÐÎʽ´«µÝ£»
    £¨3£©Ó㿽øÐзÇÌ°À·Æ¥Å䣻
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ