你可能想要这样的东西.我没有用过,但是我看了这个例子
here.
原文链接:https://www.f2er.com/php/139962.html<?PHP //create array of pairs of x and y values $dataset1 = array(); while ($row = MysqL_fetch_assoc()) { //or whatever $dataset1[] = array( $row['xvalue'],$row['yvalue'] ); } ?> <script type="text/javascript"> //put array into javascript variable var dataset1 = <?PHP echo json_encode($dataset1); ?>; //plot $(function () { $.plot($("#placeholder"),[ dataset1 ]); }); </script>