PHP jpgraph的一點小提示(附安裝方法)

來源:互聯網
上載者:User

標籤:http   io   ar   os   sp   for   strong   檔案   on   

  PHP中的GD庫本身是一套很強大的繪圖庫了,繪製的映像基本可以滿足日常要求,但強大規強大,還是不夠方便哈,因為強大方便的基於PHP的GD庫的jpgraph也就誕生啦!

  PHP預設是不啟用GD庫的,因為需要在php.ini的設定檔中將extension=php_gd2.dll注釋開啟。開啟後你就可以畫一些你想畫的各種奇葩圖案了。什嗎?不會畫?那回去學基礎!

  今天看了一下某培訓機構的視頻,看了jpgraph報表這塊兒,按照視頻方法,在http://jpgraph.net/download/上下載了Version: 3.0.7版本,解壓後在Examples目錄下建立一個jpgraph目錄,並將src目錄下的除開Examples的所有檔案剪下到Examples目錄下剛建立的jpgraph目錄內。然後把Examples拷貝到apache所配置的目錄即可。

  可是結果試了半天,老報錯:

Warning: strftime(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC‘ for now, but please set date.timezone to select your timezone. in H:\TestFile\Examples\jpgraph\jpgraph.php on line 391

JpGraph Error: HTTP headers have already been sent.
Caused by output from file jpgraph.php at line 392.Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it‘s image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).

Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php".

 

  上面的Warning報了一堆後,出現了一個錯誤:JpGraph Error,於是乎,英文不好的博主索性將這堆英文拉到百度翻譯去,索性還是沒看懂,網上找了一堆也是無人答之,後在Google下搜一下才找到。http://bbs.php100.com/simple/?t294044.html ,答案大概就是時區什麼什麼問題的,也給出瞭解決方案用date_default_timezone_set(‘Asia/Chongqing‘);設定對應的時區即可,這裡設定成了重慶。問題也就隨之解決了。

 

  隨後又下載了Version: 3.5.0b1的jpgraph,按同樣的方法試之,首頁的圖片還是載入不出來,原因是沒有‘jpgraph/jpgraph_odo.php’這個檔案,導致引入時就出了問題,而博主到網上搜了相應的檔案也複製到jpgraph目錄下,也還是未能解決,最後不了了之。

 

  有解決方案否?

PHP jpgraph的一點小提示(附安裝方法)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.