Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÀàµÄ×Ô¶¯¼ÓÔØ

ͨ³£ÎÒÃÇдһ¸öÀàÈçÏ£º
a.php
class A
{
public function __construct()
{
echo "hello world!";
}

page.php
require("a.php");
$a = new A(); 
ÎÒÃÇÊÇͨ¹ýÊÖ¹¤ÒýÓÃij¸öÀàµÄÎļþÀ´ÊµÏÖº¯Êý»òÕßÀàµÄ¼ÓÔØ
µ«Êǵ±ÏµÍ³±È½ÏÅÓ´ó£¬ÒÔ¼°ÕâЩÀàµÄÎļþºÜ¶àµÄʱºò£¬ÕâÖÖ·½Ê½¾ÍÏԵ÷dz ......

ÔÚXMLÖж¨Òå²Ëµ¥

ºÍAndroid UI layoutÒ»Ñù£¬ÎÒÃÇÒ²¿ÉÒÔÔÚXMLÖж¨ÒåÓ¦ÓóÌÐòµÄ²Ëµ¥¡£Í¨¹ýÔڲ˵¥µÄonCreateOptionsMenu·½·¨ÖÐÅòÕͲ˵¥layout¡£ÕâÑù×ö»áʹÎÒÃǵijÌÐò´úÂë¼òµ¥¶àÁË£¬¶øÇÒ¾¡¿ÉÄܵĽ«¸ü¶àµÄ½çÃæÉè¼Æ²¿·Ö·Åµ½XML£¬±ãÓÚä¯ÀÀ¡£
 
1. ÔÚ¹¤³ÌµÄ/res/Îļþ¼ÐÏ´´½¨menuÎļþ¼Ð£¬ÓÃÀ´±£´æÄãΪӦÓóÌÐò¶¨ÒåµÄ²Ëµ¥XMLÎļþ¡£
Ôڲ˵¥XML ......

Linq to XML customize distinct function

Definition comparer class,
class ItemComparer : IEqualityComparer<XElement>
{
public bool Equals(XElement x, XElement y)
{
return x.Attribute("Name").Value == x.Attribute("Name").Value;
}
public int GetHashCode(XElement obj)
......

php¼ì²âajax·½Ê½µÄµ÷ÓÃÇëÇó

±ÈÈçÒª¸øÓû§±¨¸æÒ»¸ö´íÎó£¬ÓÃÏÂÃæµÄ·½·¨£º
ʹÓÃset_error_handlerÉèÖÃ×Ô¼ºµÄ´íÎó´¦Àíº¯Êý£¬ÔÚ±¨´íµÄµØ·½Ê¹ÓÃtrigger_error£¬ÔÚ×Ô¶¨ÒåµÄ´íÎó´¦Àíº¯ÊýÖиøÓû§ÏÔʾһ¸ö³ö´íÐÅÏ¢Ò³Ãæ¡£
µ«
ÊÇÈç¹ûµ÷ÓÃtrigger_errorµÄÕâ¸öÒ³ÃæÊDZ»Ò»´ÎajaxÇëÇó´¥·¢µÄ£¬ÄÇôajax·µ»Øºó½«µÃµ½Ò»´ó¶ÑÓÃÓÚÏÔʾ´íÎóµÄhtml´úÂë¡£¶øÒ»°ã
ajaxµ÷Óö ......

php¿ª·¢web³ÌÐòµÄ¼¸µã¾­Ñé¼Ç¼

ÒÔÇ°°Ñphpµ±×÷Ò»¸ö´¿´âµÄϵͳ±à³Ì½Å±¾£¬´Ó3Ô·ݿªÊ¼µÚÒ»´ÎʹÓÃphpдwebÍøÕ¾£¬Ò»µã¾­ÑéÔÚÕâÀï×ܽáһϡ£
Ò»£º´ò¿ª´íÎóÏÔʾºÍ´íÎóÈÕÖ¾¡£ÔÚphp.iniÖаÑdispaly_errorsÉèÖÃΪOn£¬»òÕßÔڽű¾¿ªÍ·ÓÃini_set('display_errors', 'On')¡£
¶þ£º
µ÷ÊÔ¹¤¾ß±Ø±¸¡£ÐèÒªÁ½ÖÖµ÷ÊÔ¹¤¾ß£ºµÚÒ»ÖÖÊǵ÷ÊÔphp½Å±¾µÄ£¬¾ÍÏñCµ÷ÊÔÆ÷ÄÇÑù¿ÉÒÔÔڽű¾ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ