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

phpÊý¾Ý¿âµ¼³öÀà µ¼³öJSON,XML,WORD,EXCEL

from£ºhttp://www.xland.com.cn/article/7/81/0804/28778.htm
±¾ÀàʵÏÖ£º
Êý¾Ý¿âÐÅÏ¢µ¼³ö£ºword£¬excel£¬json£¬xml£¬sql
Êý¾Ý¿â»Ö¸´£º´Ósql£¬´ÓÎļþ
¾ßÌåÓ÷¨:
Ê×ÏÈн¨²âÊÔÓÃÊý¾Ý¿âmytest£¬È»ºóÔÚÀïÃ潨Õűí
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
--
-- ±íµÄ½á¹¹ `test`
--
CREATE TABLE `test` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(100) NOT NULL,
   `email` varchar(200) NOT NULL,
   `age` int(3) NOT NULL,
   PRIMARY KEY   (`id`)
) ENGINE=MyISAM   DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- µ¼³ö±íÖеÄÊý¾Ý `test`
--
INSERT INTO `test` (`id`, `name`, `email`, `age`) VALUES
(1, 'pjq518', [email=]'pjq518@126.com'[/email], 22),
(2, 'xiaoyu', [email=]'xiaoyu@126.com'[/email], 21);
1.µ¼³öextÄÜ·½±ãµ÷ÓõÄjson
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
 $db=new db();
echo  $db->toExtJson('test');
//Êä³ö½á¹ûΪ
//{'totalCount':'2','rows':[{'id':'1','name':'pjq518','email':'pjq518@126.com','age':'22'},{'id':'2','name':'xiaoyu','email':'xiaoyu@126.com','age':'21'}]}
toExtJson( $table, $start="0", $limit="10", $cons="")ÓÐ4¸ö²ÎÊý£¬ $tableΪ±íÃû£¬ $consΪÌõ¼þ£¬¿ÉÒÔΪstring»òarray
2µ¼³öxml
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
 $db=new db();
echo  $db->toExtXml('test');
//Êä³ö½á¹û

3µ¼³öexcelºÍword
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
 $db=new db();
//toExcel
 $map=array('No','Name','Email','Age');//±íÍ·
 $db->toExcel('test', $map,'µµ°¸');
//µ¼³öword±í¸ñ
// $db->toWord('test', $map,'µµ°¸');
//Ч¹ûÈçÏÂͼ
excel.JPG (27.04 KB)
2008-4-19 11:09

PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
<?php
class Db
{
var  $conn;
function Db( $host="localhost", $user="root", $pass="", $db="mytest")
{
   if(! $this->conn=mysql_connect( $host, $user, $pass))
   die("can't connect to mysql sever");
   mysql_select_db( $db,&ensp


Ïà¹ØÎĵµ£º

ÏÖÔÚתÐÐPHPÀ²£¬°¦ÕæµÄÒªÊõÒµÓÐר¹¥°¡

תÑÛ¼äÈýÄê¹ýÈ¥ÁË£¬·¢¾õ×Ô¼º¶¼»¹ÔÚÔ­µØ̤²½£¬Ë×»°Ëµ“ÄæË®ÐÐÖÛ£¬²»½øÔòÍË”£»ÈýÄê¼ä£¬´Óasp£¬javaµ½PHP£¬ÔÚ¼¸ÃÅÓïÑÔÖ®¼äշת£¬
ÿÃŶ¼»áÄÇôһµãµã£¬¾ÍÊDz»¾«Í¨£¬¸Ð¾õÿÑù¶¼ÄDz»´íÊÖ£¬ÏÖÔÚ϶¨¾öÐÄδÀ´ºÜ³¤Ò»¶Îʱ¼äÄÚ¶¼½«·ÖÅä¸øPHP£¬Ò»ÇоʹÓZend Framework¿ò¼Ü¿ªÊ¼°É ......

¡¾±±¾©PHPÅàѵ¡¿±±¾©´óѧ˫ÓŹ¤³Ì¼ò½é

 ±±¾©´óѧÈí¼þÓë΢µç×ÓѧԺ“¶à²ã´Î¡¢¶à·½Ïò¡¢¶àÁìÓò¡¢Ä£¿é»¯” µÄ¿ª·Åʽ¿Î³ÌÌåϵ£¬¾­Êµ¼ù¼ìÑéÖ¤Ã÷£¬·Ç³£ÊÊÓÃÓÚÅàÑø“¶à²ã´Î¡¢ÊµÓÃÐÍ¡¢¸´ºÏ½»²æÐÍ¡¢¹ú¼Ê»¯”µÄÈí¼þÓë΢µç×ÓÈ˲š£ÎªÂú×ãÉç»áºÍÆóÒµ¶ÔÈ˲ŵÄÐèÇ󣬶ԸßÖÊÁ¿µÄ¼ÌÐø½ÌÓýÏîÄ¿µÄÐèÇ󣬱±¾©´óѧÈí¼þÓë΢µç×ÓѧԺ³ÉÁ¢Á˼ÌÐø½ÌÓýÖÐÐÄ£¬ÃæÏòÉ ......

2010Äê×îÐÂPHPÀàµÄ¾«Ëõ¹éÄÉ

Ò»£º½á¹¹ºÍµ÷ÓÃ(ʵÀý»¯)£º
class className{} £¬µ÷Óãº$obj = new className();µ±ÀàÓй¹Ô캯Êýʱ£¬»¹Ó¦´«Èë²ÎÊý¡£Èç$obj = new className($v,$v2...);
¶þ£º¹¹Ô캯ÊýºÍÎö¹¹º¯Êý£º
1¡¢¹¹Ô캯ÊýÓÃÓÚ³õʼ»¯£ºÊ¹ÓÃ__construct()£¬¿É´ø²ÎÊý¡£
2¡¢µ«Îö¹¹º¯Êý²»ÄÜ´ø²ÎÊý£¨ÓÃÓÚÔÚÏúÈ¥Ò»¸öÀà֮ǰִÐÐһЩ²Ù×÷»ò¹¦ÄÜ£©¡£Îö¹¹º¯ÊýÓà ......

javaÉú³ÉXMLÎļþ×Ô¶¯»»ÐÐÎÊÌâ

Java codeFormat ft=Format.getRawFormat();
ft.setEncoding("utf-8");
ft.setIndent("    ");//ÉèÖÃËõ½ø
       
XMLOutputter outputter=new XMLOutputter(ft);//ÉèÖÃXML¸ñʽ
Õâλ˵µÄ²»´í£»
ÔÚieÀïÃ棬ËüÄÜ°Ñxml×Ô¶¯½âÎö³ÆÊ÷Ðνṹ£¬ËùÒÔ¿´ÆðÀ´Ã»ÎÊÌ⣬ÔÚ¼Çʱ¾ÀïÃ棬¾Í²»ÐÐÁ ......

web serverʹÓÃphpÉú³ÉwebÒ³ÃæµÄÈýÖÖ·½Ê½

²éÕÒmysql_pconnectʱÔÚmysql°ïÖúÎĵµÉÏ·¢Ïֵģ¬¼ÇÔÚÕâÀï¡£
web serverʹÓÃphpÉú³ÉÒ»¸öwebÒ³ÃæµÄÈýʽÓÐÒÔÏÂÈýÖÖ£º
Ò»£º°ÑPHP×÷ΪCGI Wrapper¡£ÕâÖÖ·½Ê½Ï£¬Ã¿¸öµ½´ïweb serverµÄÇëÇ󶼻ᵼÖÂÒ»¸öphp½âÎöÆ÷½ø³Ì±»´´½¨£¬µ±Õâ¸öphpÒ³ÃæÖ´ÐнáÊøʱ£¬Õâ¸öphp½âÎöÆ÷½ø³ÌÖÕÖ¹¡£
¶þ£º
ÔÚ¶à½ø³ÌµÄweb serverÖУ¬°Ñphp×÷Ϊweb
se ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ