PHP±à³ÌµÄÏȽø¼¼Êõ
ËäÈ»PHPÌṩÁ˺ܶ๦ÄÜÎÒÃÇ£¬µ«ÓÐЩÊÂÇ黹ûÓд¦ÀíÕâЩ·Ç³£·½±ã¡£ÀýÈ磬PHPÌṩµÄÈÕÆÚ¹¦ÄÜ£¬Ê±¼äºÜÓÐÏÞ¡£ MySQLÒѾÌṩÁËÐí¶àÎÒÃÇÕâЩ¹¦ÄÜ¡£ÎÒ¿ÉÒÔʹÓÃMySQLº¯ÊýÀ´´¦ÀíPHPµÄ¹ý³Ì£¿ÎÒÔÚÏÂÃæµÄ³¢ÊÔ¡£
“£¿ PHPµÄ
$ data_time =“1998-12-31 23:59:59”;
$ connect_id = mysql_connect£¨'±¾µØÖ÷»ú'£©;
$ query_id = mysql_query£¨“Ñ¡ÔñDATE_ADD£¨'$ data_time'£¬¼ä¸ô1Ä꣩”£¬$ connect_id£©;
$ data_time = mysql_result£¨$ query_id£¬0£©;
mysql_close£¨$ connect_id£©;
»ØÉù$ data_time;
£¿ “
Õþ¸®Ó¦¼³È¡¾Ñ飬ÎÒÃÇÔÚ±à³Ì¹ý³ÌÖÐÒ²¿ÉÒÔʹÓÃmysqlÌṩµÄÆäËûÖ°ÄÜ¡£
µ±È»£¬¹¦ÄܺÍʹÓÃÌṩÁËMySQLµÄBaituoÄãÓ¦¸ÃÈ¥µÄÊֲᡣ
²»Êʵ±µÄ£¬ÇëÖ¸Õý£¡
Ïà¹ØÎĵµ£º
#apt-get install apache2
//°²×°apahce2
#apt-get install php5
//°²×°php5
#apt-get install mysql-server
//°²×°mysql·þÎñ¶Ë
#apt-get install mysql-myclient
//°²×°mysqlµÄ¿Í»§¶Ë
#apt-get install php-mysql
//°²×°php-mysqlµÄÁ¬½á
apache+php+mysql »·¾³ÒѾ´î½¨ºÃÁË
½«ÒÔϵķþÎñÖØÆôÒ»ÏÂ
#/et ......
phpÎļþ
<?php
mysql_connect("localhost","","");
mysql_query("set names 'gb2312'");
mysql_select_db("shop");
$sqlstr="select * from goods";
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;//ÉèÖø÷¸öĿ¼µÄ·¾¶£¬ÕâÀïÊÇ°²×°µÄÖصã
$smarty->template_dir ="smarty/templates/templa ......
PHP5.0ºó£¬phpÃæÏò¶ÔÏóÌá³É¸ü¶à·½·¨£¬Ê¹µÃphp¸ü¼ÓµÄÇ¿´ó£¡£¡
һЩÔÚPHP½ÐħÊõ·½·¨µÄº¯Êý£¬ÔÚÕâÀï½éÉÜһϣºÆäʵÔÚÒ»°ãµÄÓ¦ÓÃÖУ¬ÎÒÃǶ¼ÐèÒªÓõ½ËûÃÇ£¡£¡
1.__construct() µ±ÊµÀý»¯Ò»¸ö¶ÔÏóµÄʱºò£¬Õâ¸ö¶ÔÏóµÄÕâ¸ö·½·¨Ê×Ïȱ»µ÷Óá£
Java´úÂë
class Test { function __construct() { ec ......
ÈçºÎ²»Ê¹ÓÃprepared statment£¬¶øÊÇÓùýÂ˵ķ½·¨±ÜÃâSQL×¢ÈëÄØ£¿
Ò»°ãÀ´Ëµmysql×Ô´øµÄ¹ýÂ˺¯ÊýÊDZȽϿɿ¿µÄ¡£mysql_real_escape_string()
µ«ÊÇÕâ¸öº¯ÊýÔÚijЩ×Ö·û¼¯ÖÐÓÐÎÊÌ⣬±ÈÈçGBK¡£Èç¹ûÄãÓÃUTF8ÄÇû¹Øϵ¡£
ÔÚPHPÀïÉèÖÃÊý¾Ý¿âµÄ×Ö·û¼¯²»Ó¦¸ÃÓãºmysql_query("SET NAMES UTF8");
¶øÓ¦¸ÃÓãºmysql_set_charset()
ÕâÑù ......
Õ⼸Ì죬ÎÒÔÚѧϰPHPÓïÑÔÖеÄSPL
¡£
Õâ¸ö¶«Î÷Ó¦¸ÃÊôÓÚPHPÖеĸ߼¶ÄÚÈÝ£¬¿´ÉÏÈ¥ºÜ¸´ÔÓ£¬µ«ÊǷdz£ÓÐÓã¬ËùÒÔÎÒ×öÁ˳¤Æª±Ê¼Ç¡£²»È»¼Ç²»×¡£¬ÒÔºóÒªÓõÄʱºò£¬»¹ÊÇÒª´ÓͷѧÆð¡£
ÓÉÓÚÕâÊǹ©×Ô¼º²Î¿¼µÄ±Ê¼Ç£¬²»Êǽ̳̣¬ËùÒÔдµÃ±È½Ï¼òµ¥£¬Ã»Óжà½âÊÍ¡£µ«ÊÇÎÒÏ룬Èç¹ûÄãÊÇÒ»¸öÊìÁ·µÄPHP5³ÌÐòÔ±£¬Ó¦¸Ã×ãÒÔ¿´¶®ÏÂÃæµÄ²ÄÁÏ£¬¶øÇÒ» ......