PHPÖù״ͼ¡¢±ý״ͼºÍÏßÐÔͼ
Ê×ÏÈÎÒÃÇÒª½éÉÜÒ»ÏÂÎÒÃÇÔÚÕâƪÎÄÕÂÖÐʹÓõÄPHPÀàLibchart£¬ÕâÊǸöÍâ¹úÈË£¨·ÇÖйú¹ú¼®µÄµØÇòÈË£¬±»³ÆΪÍâ¹úÈË£¡£©Ð´µÄÃâ·ÑÀ࣡ʹÓÃÆðÀ´·Ç
³£¼òµ¥¡£¿´³öÀ´ÁË°É£¬ÎÒÃÇÊÇÒªÓÃÒ»¸öÍâ¹úÈËдµÄPHP´´½¨Öù״ͼ£¬±ý״ͼ£¬ºÍÏßÐÔͼµÄÀ࣬À´¹¤×÷µÄ¡£Èç¹ûÄãҪѧϰÕâ¸öÀàµÄд·¨£¬ÄãÒ²¿ÉÒÔ°ÑÕâ¸öÀàÏÂÔØÏÂÀ´¿´¿´Íâ¹úÈ˵Ä˼·£¡
ÎÒÃÇ¿ªÊ¼°É£¬Ê×ÏÈÏÂÔØÕâ¸öÀà µã»÷´Ë´¦£ºÏÂ
ÔØLibchart
£¬½âѹËõ£¡
µÚÒ»¸öÓÃÀý£¬ÎÒÃÇÀ´´´½¨Ò»¸ö×ÝÏòµÄÖù״ͼ£º
Ê×ÏÈÎÒÃÇ°üº¬Õâ¸öÀàÎļþµ½ÎÒÃǵijÌÐòÖУ¬²¢ÇÒʵÀý»¯Õâ¸öÀ࣬³ÌÐòÈçÏ£º
requir_once(
'./Libchart/classes/libchart.php'
)
;
$chart
=
new
VerticalBarChart(
500
,
250
)
;
//²ÎÊý±íʾÐèÒª´´½¨µÄͼÏñµÄ¿íºÍ¸ß
$dataSet
=
new
XYDataSet(
)
;
//ʵÀý»¯Ò»¸öXYÖáÊý¾Ý¶ÔÏó
//ΪÕâ¸ö¶ÔÏóÔö¼ÓËÄ×éÊý¾Ý¼¯ºÏ£¬Point¶ÔÏóµÄµÚÒ»¸ö²ÎÊý±íʾXÖá×ø±ê£¬µÚ¶þ¸ö±íʾYÖá×ø±ê
$dataSet
->
addPoint
(
new
Point(
"Jan 2005"
,
273
)
)
;
$dataSet
->
addPoint
(
new
Point(
"Feb 2005"
,
321
)
)
;
$dataSet
->
addPoint
(
new
Point(
"March 2005"
,
442
)
)
;
$dataSet
->
addPoint
(
new
Point(
"April 2005"
,
711
)
)
;
//°ÑÕâ¸öÊý¾Ý¼¯ºÏ´«µÝ¸øͼÐζÔÏó
$chart
->
setDataSet
(
$dataSet
)
;
//ÉèÖÃͼÐεıêÌ⣬²¢°ÑËü×÷Ϊһ¸öpngÎļþäÖȾ
$chart
->
setTitle
(
"Monthly usage for www.example.com"
)
;
$chart
->
render
(
"generated/demo1.png"
)
;
//ÕâÀïÐèÒªÒ»¸ö·¾¶ºÍÎļþÃû³Æ
¾ÍÕâô¼òµ¥Ò»¸öÏñÏÂͼһÑùÃÀÀöµÄÖù״ͼ¾Í³öÀ´ÁË¡£
PHPÖù״ͼ
PHP´´½¨Ò»¸ö±ý״ͼµÄ¹ý³ÌºÍÉϱß˵µÄÖù״ͼ´óͬСÒì
£¬¾ßÌåʵÀý´úÂëÈçÏ£º
$chart
=
new
PieChart(
500
,
250
)
;
$dataSet
=
new
XYDataSet(
)
;
$dataSet
->
addPoint
(
new
Point(
"Mozilla Firefox (80)"
,
80
)
)
;
$dataSet
->
addPoint
(
new
Point(
"Konqueror (75)"
,
75
)
)
;
$dataSet
->
addPoint
(
new
Point(
"Other (50)"
,
50
)
)
;
$chart
->
setDataSet
(
$dataSet
)
;
$chart
->
setTitle
(
"
Ïà¹ØÎĵµ£º
PHP5ÖÐÔöÇ¿ÁËXML
µÄ
Ö§³Ö£¬Ê¹ÓÃDOM
À©Õ¹ÁËXML²Ù×÷µÄÄÜÄÍ¡£ÕâЩº¯Êý
×÷Ϊ PHP5 ºËÐĵÄÒ»²¿·Ö£¬ÎÞÐè±»°²×°
¼´¿ÉʹÓá£
ÏÂÃæµÄÀý×Ó¼òµ¥µÄÑÝʾÁËDOM¶ÔXMLµÄ²Ù
×÷£¬Ïêϸ½âÊÍÇë¿´´úÂë
ÖеÄ×¢ÊÍ
<?
/************************************************
** & ......
¾µäÑ»·Àý×Ó
<HTML>
<HEAD>
<TITLE>¾µäÑ»·Àý×Ó</TITLE>
</HEAD>
<BODY>
<?
for($counter = 1; $counter <= 6; $counter++)
//Ñ»·6´Î
{
print("<B& ......
1¡¢Èç¹ûÄܽ«ÀàµÄ·½·¨¶¨Òå³Éstatic£¬¾Í¾¡Á¿¶¨Òå³Éstatic£¬ËüµÄËٶȻáÌáÉý½«½ü4±¶¡£
2¡¢$row['id'] µÄËÙ¶ÈÊÇ$row[id]µÄ7±¶¡£
3¡¢echo ±È print ¿ì£¬²¢ÇÒʹÓÃechoµÄ¶àÖزÎÊý(Òë×¢£ºÖ¸ÓöººÅ¶ø²»ÊǾäµã)´úÌæ×Ö·û´®Á¬½Ó£¬±ÈÈçecho $str1,$str2¡£
4¡¢×îºÃʹÓÃForeachÖ´ÐÐÑ»·£¬ÔÚÖ´ÐÐforÑ»·Ö®Ç°È·¶¨×î´óÑ»·Êý£¬²»ÒªÃ¿Ñ»·Ò»´ ......
·½·¨Ò»£º
<?php
function extend_1($file_name)
{
$retval="";
$pt=strrpos($file_name, ".");
if ($pt) $retval=substr($file_name, $pt+1, strlen($file_name) - $pt);
return ($retval);
}
?>
·½·¨¶þ£º
function extend_2($file_name)
{
$extend = pathinfo($file_name);
$extend = strto ......