WindowsÏ°²×°×îеÄApache+PHP+MySQLÖ¸ÄÏ
×¢Ò⣺֮ǰÎÒÔÚÍøÉÏÕÒÁ˺öàµÄ×ÊÁÏ NND¶¼²»ÄÜÕý³£ÅäÖóɹ¦ ¸ãµÃÎÒÊǷdz£µØÓôÃÆ£¡
ÕÒµ½ÕâƪÎÄÕÂÖ®ºóÎÒÖÕÓÚÅäÖóɹ¦ÁË£¡ÍÛºÃˬѽ£¡Ö»Òª°´ÕÕ ÉÏÃæµÄ²½Öè¾ÍÒ»¶¨Äܹ»³É¹¦µÄ£¡
´ËÎÄյݲװ·½·¨ÊÊÓÃÓÚWindows XPϵÄApache+PHP+MySQL°²×°£¬Í¬Ê±Ò²ÊÊÓÃÓÚWindows 2003ϵͳϵݲװºÍÅäÖá£
1. °²×°»·¾³
²Ù×÷ϵͳÊÇ Windows XP ÖÐÎÄ°æ, Apache, PHP, MySQL µÄ×îа汾ÊǽØÖ¹µ½ 2007.09.07£¬·Ö±ðÔÚÆä¹ÙÍøÏÂÔصÄ:
* Apache 2.2.6£ºhttp://apache.mirror.phpchina.com/httpd/binaries/win32/
* PHP 5.2.4 (Windows Binaries PHP 5.2.4 zip package£©: http://www.php.net/downloads.php ÎÒ֮ǰÊÇÏÂÔØÁËÒ»¸öexe¸ñʽµÄ¹þ¹þ ÏÖÔÚÏÂÁËÒ»¸özip¸ñʽµÄ
* MySQL 5.0.45 Windonws: http://dev.mysql.com/downloads/
2. °²×°µÄĿ¼½á¹¹¹æ»®
ΪÁË·½±ãά»¤£¬¿ÉÒÔ½«·þÎñÆ÷Èí¼þ°²×°ÔÚϵͳÅÌ£¨CÅÌ£©¶ø°Ñ×Ô¼ºµÄÎļþ¶¨Î»µ½ÆäËûÅÌ£¬ÕâÑù¶ÔÓÚÒÔºóµÄά»¤ºÜÖØÒª¡£
3. ÔÚ Windows XP Ï°²×° Apache 2.2.6
Windows XP ϵݲװ
1. ÔËÐÐ apache 2.2.6 µÄ°²×°³ÌÐò£¬¸ù¾ÝÌáʾһ· Next ¼´¿É¡£ÔÚ Server Information µÄ Network Domain¡¢Server Name ×Ö¶ÎËæ±ãÌîÉÏÒ»¸öÓòÃû¼´¿É£¬Èçphp.com£¬È»ºó¸ù¾ÝÌáʾһ· Next Íê³É¼´¿É¡£
2. ÔÚ°²×°½áÊøʱ£¬»áµ¯³öÒ»¸ö DOS ´°¿Ú£¬È»ºó¾ÍÏûʧÁË£¬ÕâÊÇϵͳapache×Ô¶¯Æô¶¯ÁË¡£
4. ÔÚ Windows XP Ï°²×° php 5.2.4
1. ½«ÏÂÔØµÄ php 5 ZIP °üÖ±½Ó½âѹ£¬ÎÒÖ±½Ó½« PHP 5.2.4 zip Îļþ½âѹµ½ d:\php Ŀ¼ÏÂÃæ¡£°²×° php ²»½¨ÒéʹÓà win32 °²×°³ÌÐò(Ö÷ÒªÊÇÒÔºó°²×°À©Õ¹Âé·³£©¡£
2. ÔÚ×ÊÔ´¹ÜÀíÆ÷ÖнøÈë php µÄ°²×°Ä¿Â¼£¬½« php.ini-dist »ò php.ini-recommended ¸´ÖÆÒ»·Ý£¬ÃüÃûΪ php.ini¡£È»ºó´ò¿ª php.ini¡£
3. ÕÒµ½:
;extension=php_mysql.dll
½«Ç°ÃæµÄ ; ºÅÈ¥µô£¬ ¸Ä³É£º
extension=php_mysql.dll
4. ÕÒµ½:
extension_dir = “./”
½«Æä¸ÄΪÄãµÄ php °²×°Ä¿Â¼Ï ext ×ÓĿ¼µÄ¾ø¶Ô·¾¶¡£ÀýÈçÎҵģº
extension_dir = “D:/php/ext/”
Õâ²½ºÜÖØÒª ¡£·ñÔò½ÓÏÂÀ´ php »áÕÒ²»µ½ php_mysql.dll Ä£¿é£¬ÎÞ·¨×°ÔØ¡£
5. ÔÚ“¿ØÖÆÃæ°å”->“ϵͳ”->“¸ß¼¶”->“»·¾³±äÁ¿”£¬Ôړϵͳ±äÁ¿”ÀïÃæÕÒµ½path£¬±à¼pathµÄ±äÁ¿Öµ£¬Ìí¼ÓÄãµÄphpĿ¼D:\php£¬Ç°ÃæÒ»¶¨ÒªÓ÷ֺÅ(;)°ÑËüºÍÇ°ÃæµÄÖµ·Ö¿ª¡£
5. ÅäÖà Apache ºÍ PHP
´ò¿ª Apache °²×°Ä¿Â¼Ï嵀 conf ×ÓÄ¿Â
Ïà¹ØÎĵµ£º
µÚÒ»²½£ºÐÞ¸ÄÊý¾Ý¿âÅäÖÃÎļþmy.ini
¿Í»§¶ËµÄĬÈÏ×Ö·û±àÂ룺
default-character-set=utf8
·þÎñÆ÷¶ËµÄĬÈÏ×Ö·û±àÂë
default-character-set=utf8
µÚ¶þ²½£ºÖØÐÂÆô¶¯mysqlÊý¾Ý¿â
net stop mysql
net start mysql
µÚ¶þ²½£ºÐÞ¸ÄapplicationContent.xml
ÐÞ¸ÄurlÊôÐÔ£¬½«Æä¸ÄΪ£ºjdbc:mysql://localhost:3306/member?useUni ......
PHPµÄJSONÀà¿âÎÒʹÓõÄÊÇServices_JSON
£¬Ã»Ê²Ã´ÌرðµÄÓŵ㣬ҲûʲôÃ÷ÏÔµÄȱµã£¬¶Ô¸¶ÓÃ×ãÒÓ¡£
½¨Á¢Îļþdata.php
£º
<?php
include(
"JSON.php"
);
$data
= array(
array(
'name'
=>
mb_convert_encoding
(
'ÀÏÍõ'
,
'UTF-8'
,
'GBK'
), ......
ÕûµÄº¯Êý£¬½ñÌìССµÄ×ܽáһϣ¡ÆäʵºÜ¼òµ¥£¬¾ÍÊǼ¸¸öº¯Êý¶øÒÑ¡«¡«Ö÷ÒªÊÇ£ºceil£¬floor£¬round£¬intval
ceil -- ½øÒ»·¨È¡Õû
˵Ã÷
float ceil ( float value )
·µ»Ø²»Ð¡ÓÚ value µÄÏÂÒ»¸öÕûÊý£¬value Èç¹ûÓÐСÊý²¿·ÖÔò½øһλ¡£ceil() ·µ»ØµÄÀàÐÍÈÔÈ»ÊÇ float£¬ÒòΪ float ÖµµÄ·¶Î§Í¨³£±È integer Òª´ó¡£
Àý×Ó 1. ceil ......
phpÖÐÈÕÆÚת»»º¯ÊýstrtotimeµÄÓ÷¨:
Óï·¨:
int strtotime ( string time [, int now] )
·µ»Ø½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ Unix ʱ¼ä´Á
ʵÀý:
Ò»£¬»ñÈ¡Ö¸¶¨ÈÕÆÚµÄunixʱ¼ä´Á strtotime("2009-1-22") ʾÀýÈçÏ£º
echo strtotime("2009-1-22") ½á¹û£º1232553600
˵Ã÷£º·µ»Ø2009Äê1ÔÂ22ÈÕ0µã ......
1.
$query = $this->db->query('SELECT name, title, email from my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
2.
foreach ($query->result_array() as $row)
{ ......