天天看點

Amchars實戰(面向對象)

檔案:

amcolumn.rar

大小:

162KB

下載下傳:

<a href="http://blogimg.chinaunix.net/blog/upfile2/101228201159.rar">下載下傳</a>

example.php:

&lt;?php

//說明:

//1、先運作本php檔案中的代碼,生成想要展現的資料。随後,在Html檔案中插入一對即可,請參見aucolumn.html檔案

//2、導出flash圖表為圖檔功能僅限于程式運作于伺服器之上才能正常使用

//3、該圖針對的是兩行資料統計,比如年份/産量。其它多資料請改用别的圖表,聯系我

//4、軟體被我破解,沒有版權顯示了

//Good Luck!

include('./amcolumn/chart.php');

$link = new getConn('localhost(主機名或IP位址)','test(資料庫名)','root(資料庫使用者名)','(資料庫密碼)');

$link-&gt;getResult('select * from sum(sql語句)');

?&gt;

chart.php:

class getConn{

    private $host;

    private $dbname;

    private $dbuser;

    private $dbpass;

    public function __construct($_host,$_dbname,$_dbuser,$_dbpass){

        $this-&gt;host = $_host;

        $this-&gt;dbname = $_dbname;

        $this-&gt;dbuser = $_dbuser;

        $this-&gt;dbpass = $_dbpass;

    }

    public function getResult($_sql){

        $con = mysql_connect($this-&gt;host,$this-&gt;dbuser,$this-&gt;dbpass);

        mysql_select_db($this-&gt;dbname,$con);

        $result = mysql_query($_sql,$con);

        while($array[] = mysql_fetch_row($result));

        $this-&gt;putOutCsv($array);

    public function putOutCsv($arrayIn){

        for($i=0;$i            $arrayIn[$i] = @array_slice($arrayIn[$i],1);

        }

        foreach($arrayIn as $tmp){

            $list[] = @implode(',',$tmp);

        $fp = fopen('./amcolumn/amcolumn_data.txt','w');

        foreach($list as $line)

            if(!fputcsv($fp,split(',',$line),';')){

                echo '導入檔案錯誤';die();

            }

        echo '操作成功';

        fclose($fp);

}

閱讀(1551) | 評論(0) | 轉發(0) |