Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : php

crontabÀïÔËÐÐphpÎÞ·¨Á¬½Óµ½Êý¾Ý¿â

ÎÒÔÚmy.cnfÖÐ×¢Ê͵ôlog-bin=mysql-binºÍbinlog_format=mixedºó,ÎÞ·¨Æô¶¯mysql
ÎÒÖØÆôvpsºó,ÄÜÆô¶¯mysqlÀ²
ÓÃweb·½Ê½ÔËÐÐphp,Õý³£
µ«ÊÇÔÚcrontabÀïÖ´ÐеÄphp½Å±¾,Ìáʾ: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) ²é¿´µ½/var/lib/mysql/Ŀ¼ÏÂ,ÓÐÒ»¸ömysql.sockÎļþ,ÊÇÒ»¸ö¿ì½Ý·½Ê½µÄͼ±ê,Á¬½Óµ½/tmp/mysql.sockÎļþ.
µ«ÊÇÎÒµÄmy.cnfÀïÉèÖõÄsocket        = /tmp/mysql.sock ÏëÆð֮ǰÎʹýÕâ¸öÎÊÌâ CentOSϵͳ°²×°ÁËLNMP°üÖ®ºóÔÙ×°php-mysql,³öÏÖsocket´íÎó È»ºóÓÖÕÒµ½Ò»ÆªÎÄÕ Can¡¯t connect to local MySQL server through socket ½â¾ö°ì·¨ °´ÎÄÕµÄÌáʾ²é¿´ÁË/var/lib/mysql/mysql.sock ÎļþµÄȨÏÞ,ÊÇwww:www ÓÃchown mysql:mysql /var/lib/mysql.sock ÃüÁîÐ޸ĺóÕý³£. Ææ¹ÖµÄÊÇ,֮ǰÔÚcrontabÒ»Ö±ÄÜÔËÐÐphp,ÖØÆôVPSºó²Å²»Õý³£µÄ,ÄѵÀÖØÆôVPS»áµ¼ÖÂ/var/lib/mysql.sockµÄȨÏ޸ıä?? ......

PHP·¢ËÍEmail Àà


 ¾­²âÊÔ  ûÓÐÎÊÌâ
<?
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = FALSE;
$this->smtp_port = $smtp_port;
$this->relay_host = $relay_host;
$this->time_out = 30; //is used in fsockopen()
#
$this->auth = $auth;//auth
$this->user = $user;
$this->pass = $pass;
#
$this->host_name = "localhost"; //is used in HELO command
$this->log_file ="";
$this->sock = FALSE;
}
/* Main Function */
function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "")
{
$mail_from = $this->get_address($this->strip_comment($from));
$body = ereg_re ......

PHP·ÖÒ³ÏÔʾÖÆ×÷Ïêϸ½²½â


1¡¢Ç°ÑÔ
·ÖÒ³ÏÔʾÊÇÒ»Öַdz£³£¼ûµÄä¯ÀÀºÍÏÔʾ´óÁ¿Êý¾ÝµÄ·½·¨£¬ÊôÓÚweb±à³ÌÖÐ×î³£´¦ÀíµÄʼþÖ®Ò»¡£¶ÔÓÚweb±à³ÌµÄÀÏÊÖÀ´Ëµ£¬±àдÕâÖÖ´úÂëʵÔÚÊǺͺôÎüÒ»Ñù×ÔÈ»£¬µ«ÊǶÔÓÚ³õѧÕßÀ´Ëµ£¬³£³£¶ÔÕâ¸öÎÊÌâÃþ²»×ÅÍ·Ð÷£¬Òò´ËÌصØ׫д´ËÎĶÔÕâ¸öÎÊÌâ½øÐÐÏêϸµÄ½²½â£¬Á¦ÇóÈÿ´ÍêÕâƪÎÄÕµÄÅóÓÑÔÚ¿´ÍêÒÔºó¶ÔÓÚ·ÖÒ³ÏÔʾµÄÔ­ÀíºÍʵÏÖ·½·¨ÓÐËùÁ˽⡣±¾ÎÄÊʺϳõѧÕßÔĶÁ£¬ËùÓÐʾÀý´úÂë¾ùʹÓÃphp±àд¡£
2¡¢Ô­Àí
Ëùν·ÖÒ³ÏÔʾ£¬Ò²¾ÍÊǽ«Êý¾Ý¿âÖеĽá¹û¼¯ÈËΪµÄ·Ö³ÉÒ»¶ÎÒ»¶ÎµÄÀ´ÏÔʾ£¬ÕâÀïÐèÒªÁ½¸ö³õʼµÄ²ÎÊý£º
ÿҳ¶àÉÙÌõ¼Ç¼£¨$PageSize£©£¿
µ±Ç°Êǵڼ¸Ò³£¨$CurrentPageID£©£¿
ÏÖÔÚÖ»ÒªÔÙ¸øÎÒÒ»¸ö½á¹û¼¯£¬ÎҾͿÉÒÔÏÔʾij¶ÎÌض¨µÄ½á¹û³öÀ´¡£
ÖÁÓÚÆäËûµÄ²ÎÊý£¬±ÈÈ磺ÉÏÒ»Ò³£¨$PreviousPageID£©¡¢ÏÂÒ»Ò³£¨$NextPageID£©¡¢×ÜÒ³Êý£¨$numPages£©µÈµÈ£¬¶¼¿ÉÒÔ¸ù¾ÝÇ°±ßÕ⼸¸ö¶«Î÷µÃµ½¡£
ÒÔmysqlÊý¾Ý¿âΪÀý£¬Èç¹ûÒª´Ó±íÄÚ½Øȡij¶ÎÄÚÈÝ£¬sqlÓï¾ä¿ÉÒÔÓãºselect * from table limit offset, rows¡£¿´¿´ÏÂÃæÒ»×ésqlÓï¾ä£¬³¢ÊÔһϷ¢ÏÖÆäÖеĹæÂÊ¡£
Ç°10Ìõ¼Ç¼£ºselect * from table limit 0,10
µÚ11ÖÁ20Ìõ¼Ç¼£ºselect * from table limit 10,10
µÚ21ÖÁ30Ìõ¼Ç¼£ºselect * from table limit 20, ......

PHPÖеij£ÓõÄ25¸öMYSQLº¯Êý


1¡¢mysql_connect()-½¨Á¢Êý¾Ý¿âÁ¬½Ó
¸ñʽ£º
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
Àý£º
$conn = @mysql_connect(”localhost”, “username”, “password”) or dir(”²»ÄÜÁ¬½Óµ½Mysql Server”);
˵Ã÷£ºÊ¹ÓøÃÁ¬½Ó±ØÐëÏÔʾµÄ¹Ø±ÕÁ¬½Ó
2¡¢mysql_pconnect()-½¨Á¢Êý¾Ý¿âÁ¬½Ó
¸ñʽ£º
resource mysql_pconnect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
Àý£º
$conn = @mysql_pconnect(”localhost”, “username”, “password”) or dir(”²»ÄÜÁ¬½Óµ½Mysql Server”);
˵Ã÷£ºÊ¹ÓøÃÁ¬½Óº¯Êý²»ÐèÒªÏÔʾµÄ¹Ø±ÕÁ¬½Ó£¬ËüÏ൱ÓÚʹÓÃÁËÁ¬½Ó³Ø
3¡¢mysql_close()-¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
Àý£º
$conn = @mysql_connect(”localhost”, “username”, “password”) or die(”²»ÄÜÁ¬½Óµ½Mysql Server”);
@mysql_select_db(”MyDatabase”) or die(”²»ÄÜÑ¡ÔñÕâ¸öÊý¾Ý¿â£¬»òÊý¾Ý¿â²»´æÔÚ”);
echo &l ......

PHPÖеij£ÓõÄ25¸öMYSQLº¯Êý


1¡¢mysql_connect()-½¨Á¢Êý¾Ý¿âÁ¬½Ó
¸ñʽ£º
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
Àý£º
$conn = @mysql_connect(”localhost”, “username”, “password”) or dir(”²»ÄÜÁ¬½Óµ½Mysql Server”);
˵Ã÷£ºÊ¹ÓøÃÁ¬½Ó±ØÐëÏÔʾµÄ¹Ø±ÕÁ¬½Ó
2¡¢mysql_pconnect()-½¨Á¢Êý¾Ý¿âÁ¬½Ó
¸ñʽ£º
resource mysql_pconnect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
Àý£º
$conn = @mysql_pconnect(”localhost”, “username”, “password”) or dir(”²»ÄÜÁ¬½Óµ½Mysql Server”);
˵Ã÷£ºÊ¹ÓøÃÁ¬½Óº¯Êý²»ÐèÒªÏÔʾµÄ¹Ø±ÕÁ¬½Ó£¬ËüÏ൱ÓÚʹÓÃÁËÁ¬½Ó³Ø
3¡¢mysql_close()-¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
Àý£º
$conn = @mysql_connect(”localhost”, “username”, “password”) or die(”²»ÄÜÁ¬½Óµ½Mysql Server”);
@mysql_select_db(”MyDatabase”) or die(”²»ÄÜÑ¡ÔñÕâ¸öÊý¾Ý¿â£¬»òÊý¾Ý¿â²»´æÔÚ”);
echo &l ......

̽ÌÖPHP SQL×¢ÈëµÄ½â¾ö˼·

˼·:SQLÀᄀ¿ÉÄܵIJÉÓÃÁ½¸öÒýºÅ±ÕºÏ±äÁ¿;¶Ô±äÁ¿ÖеÄÒýºÅתÒå;¶Ô²»ÄܲÉÓÃ2¸öÒýºÅ±ÕºÏµÄ±äÁ¿,ÏÈÔ¤ÏÈÅжϱäÁ¿ÀàÐÍ;  
   
  ·½°¸:  
  1   ËùÓзÇÊýÖµÔËËã(Èç×Ö·û,¼òµ¥ÊýÖµÐ͵ȵÈ)µÄSQL±äÁ¿¶¼¼ÓÒýºÅ;  
  2   ËùÓзÇÊýÖµÔËËãµÄSQL±äÁ¿µÄÖµ¶¼²ÉÓÃmagic_quotes_gpc»òÕßaddslashesתÒå;  
  3   ¶ÔÐèÒªÊýÖµÔËËãµÄ±äÁ¿ºÍÆäËû²»ÄܼÓÒýºÅµÄSQL(ÈçINÓï¾ä),Ô¤ÏÈÅжϱäÁ¿ÀàÐÍ.  
  4   ¹Ø±Õphp.iniµÄdisply_error.(¿ÉÑ¡,Èç²»ÄܹرÕ,Ðè×Ô¼ºÊÖ¶¯ÈÃSQLÓï¾ä²»ÄÜÖ´Ðб¨´í)
php5ժ¼
Ô¤·À´ëÊ©
Ò²ÐíÓÐÈË»á×ÔÎÒ°²Î¿£¬Ëµ¹¥»÷ÕßÒªÖªµÀÊý¾Ý¿â½á¹¹µÄÐÅÏ¢²ÅÄÜʵʩÉÏÃæµÄ¹¥»÷¡£Ã»´í£¬È·ÊµÈç´Ë¡£µ«Ã»ÈËÄܱ£Ö¤¹¥»÷ÕßÒ»¶¨µÃ²»µ½ÕâЩÐÅÏ¢£¬Ò»µ«ËûÃǵõ½ÁË£¬Êý¾Ý¿âÓÐ鶵ÄΣÏÕ¡£Èç¹ûÄãÔÚÓÿª·ÅÔ´´úÂëµÄÈí¼þ°üÀ´·ÃÎÊÊý¾Ý¿â£¬±ÈÈçÂÛ̳³ÌÐò£¬¹¥»÷Õ߾ͺÜÈݵõ½µ½Ïà¹ØµÄ´úÂë¡£Èç¹ûÕâЩ´úÂëÉè¼Æ²»Á¼µÄ»°£¬·çÏվ͸ü´óÁË¡£
ÕâЩ¹¥»÷×ÜÊǽ¨Á¢ÔÚ·¢¾ò°²È«Òâʶ²»Ç¿µÄ´úÂëÉϵġ£ËùÒÔ£¬ÓÀÔ¶²»ÒªÐÅÈÎÍâ½çÊäÈëµÄÊý¾Ý£¬ÌرðÊÇÀ´×ÔÓÚ¿Í»§¶ËµÄ£¬°üÀ¨Ñ¡Ôñ¿ò¡¢±íµ¥Òþ²ØÓòºÍ cookie¡£¾ÍÈçÉÏÃæµÄµÚÒ»¸öÀý×ÓÄÇÑù£¬¾ÍËãÊÇÕý³£µÄ² ......

̽ÌÖPHP SQL×¢ÈëµÄ½â¾ö˼·

˼·:SQLÀᄀ¿ÉÄܵIJÉÓÃÁ½¸öÒýºÅ±ÕºÏ±äÁ¿;¶Ô±äÁ¿ÖеÄÒýºÅתÒå;¶Ô²»ÄܲÉÓÃ2¸öÒýºÅ±ÕºÏµÄ±äÁ¿,ÏÈÔ¤ÏÈÅжϱäÁ¿ÀàÐÍ;  
   
  ·½°¸:  
  1   ËùÓзÇÊýÖµÔËËã(Èç×Ö·û,¼òµ¥ÊýÖµÐ͵ȵÈ)µÄSQL±äÁ¿¶¼¼ÓÒýºÅ;  
  2   ËùÓзÇÊýÖµÔËËãµÄSQL±äÁ¿µÄÖµ¶¼²ÉÓÃmagic_quotes_gpc»òÕßaddslashesתÒå;  
  3   ¶ÔÐèÒªÊýÖµÔËËãµÄ±äÁ¿ºÍÆäËû²»ÄܼÓÒýºÅµÄSQL(ÈçINÓï¾ä),Ô¤ÏÈÅжϱäÁ¿ÀàÐÍ.  
  4   ¹Ø±Õphp.iniµÄdisply_error.(¿ÉÑ¡,Èç²»ÄܹرÕ,Ðè×Ô¼ºÊÖ¶¯ÈÃSQLÓï¾ä²»ÄÜÖ´Ðб¨´í)
php5ժ¼
Ô¤·À´ëÊ©
Ò²ÐíÓÐÈË»á×ÔÎÒ°²Î¿£¬Ëµ¹¥»÷ÕßÒªÖªµÀÊý¾Ý¿â½á¹¹µÄÐÅÏ¢²ÅÄÜʵʩÉÏÃæµÄ¹¥»÷¡£Ã»´í£¬È·ÊµÈç´Ë¡£µ«Ã»ÈËÄܱ£Ö¤¹¥»÷ÕßÒ»¶¨µÃ²»µ½ÕâЩÐÅÏ¢£¬Ò»µ«ËûÃǵõ½ÁË£¬Êý¾Ý¿âÓÐ鶵ÄΣÏÕ¡£Èç¹ûÄãÔÚÓÿª·ÅÔ´´úÂëµÄÈí¼þ°üÀ´·ÃÎÊÊý¾Ý¿â£¬±ÈÈçÂÛ̳³ÌÐò£¬¹¥»÷Õ߾ͺÜÈݵõ½µ½Ïà¹ØµÄ´úÂë¡£Èç¹ûÕâЩ´úÂëÉè¼Æ²»Á¼µÄ»°£¬·çÏվ͸ü´óÁË¡£
ÕâЩ¹¥»÷×ÜÊǽ¨Á¢ÔÚ·¢¾ò°²È«Òâʶ²»Ç¿µÄ´úÂëÉϵġ£ËùÒÔ£¬ÓÀÔ¶²»ÒªÐÅÈÎÍâ½çÊäÈëµÄÊý¾Ý£¬ÌرðÊÇÀ´×ÔÓÚ¿Í»§¶ËµÄ£¬°üÀ¨Ñ¡Ôñ¿ò¡¢±íµ¥Òþ²ØÓòºÍ cookie¡£¾ÍÈçÉÏÃæµÄµÚÒ»¸öÀý×ÓÄÇÑù£¬¾ÍËãÊÇÕý³£µÄ² ......

phpѧϰÐĵÃ(ÊʺÏphp³õѧÕß)


À´Ô´£º ·¢²¼Ê±¼ä£º2009-09-18 ·¢²¼ÈË£º ä¯ÀÀ£º30È˴Π ×ÖÌ壺[´ó ÖРС]  
 ¡¾1¡¿Ò³ÃæÖ®¼äÎÞ·¨´«µÝ±äÁ¿ get,post,sessionÔÚ×îеÄphp°æ±¾ÖÐ×Ô¶¯È«¾Ö±äÁ¿Êǹرյģ¬ËùÒÔÒª´ÓÉÏÒ»Ò³ÃæÈ¡µÃÌá½»¹ýÀ´µÃ±äÁ¿ÒªÊ¹ÓÃ$_GET['foo'],$_POST['foo'],$_SESSION['foo']À´µÃµ½
µ±È»Ò²¿ÉÒÔÐÞ¸Ä×Ô¶¯È«¾Ö±äÁ¿Îª¿ª(php.ini¸ÄΪregister_globals = On)£»¿¼Âǵ½¼æÈÝÐÔ£¬»¹ÊÇÇ¿ÆÈ×Ô¼ºÊìϤеÄд·¨±È½ÏºÃ¡£
¡¾2¡¿Win32ÏÂapache2 ÓÃget·½·¨´«µÝÖÐÎIJÎÊý»á³ö´í
test.php?a=ÄãºÃ&b=ÄãÒ²ºÃ
´«µÝ²ÎÊýÊǻᵼÖÂÒ»¸öÄÚ²¿´íÎó
½â¾ö°ì·¨:"test.php?a=".urlencode(ÄãºÃ)."&b=".urlencode(ÄãÒ²ºÃ)
.............
 
¡¾3¡¿win32ϵÄsession²»ÄÜÕý³£¹¤×÷
php.iniĬÈϵÄsession.save_path = /tmp
ÕâÏÔÈ»ÊÇlinuxϵÄÅäÖã¬win32ÏÂphpÎÞ·¨¶ÁдsessionÎļþµ¼ÖÂsessionÎÞ·¨Ê¹ÓÃ
°ÑËü¸Ä³ÉÒ»¸ö¾ø¶Ô·¾¶¾Í¿ÉÒÔÁË£¬ÀýÈçsession.save_path = c:windows emp
¡¾4¡¿ÏÔʾ´íÎóÐÅÏ¢
µ±php.iniµÄdisplay_errors = On²¢ÇÒerror_reporting = E_ALLʱ£¬½«ÏÔʾËùÓеĴíÎóºÍÌáʾ£¬µ÷ÊÔµÄʱºò×îºÃ´ò¿ªÒÔ±ã¾À´í£¬Èç¹ûÄãÓÃÒÔÇ°phpд·¨´íÎóÐÅÏ¢¶à°ëÊǹØÓÚ䶨Òå±äÁ¿µÄ¡£±äÁ¿ÔÚ¸³ÖµÒÔÇ°µ÷Óû ......
×ܼǼÊý:2174; ×ÜÒ³Êý:363; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [14] [15] [16] [17] 18 [19] [20] [21] [22] [23]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ