我的任务是解决如何将 JSON 编码更改为数组字符串,请查看下面的代码:我有
["11:00"]["09:00"]["01:00"]["12:00"]["11:00"]["10:00"]["01:00"]["00:00"]["23:00"]["22:00"]
如何改变它成为
["11:00","09:00","01:00","11:00","10:00","01:00","00:00","23:00","22:00"]
我的stats.php样子是这样的:
out .= ' <div class="col-lg-5 col-md-5 col-sm-5 col-lg-offset-1 col-md-offset-1 col-sm-offset-1" style="height: 300px">';
$out .= ' <div class="chartjs-size-monitor">';
$out .= ' <div class="chartjs-size-monitor-expand">';
$out .= ' <div class=""></div>';
$out .= ' </div>';
$out .= ' <div class="chartjs-size-monitor-shrink">';
$out .= ' <div class=""></div>';
$out .= ' </div>';
$out .= ' </div>';
$out .= ' <canvas id="myChart2" class="canpas chartjs-render-monitor" style="display: block; width: 454px; height: 300px;" width="454" height="300"></canvas>';
$out .= ' </div>';
$graph_query = mssql_query("SELECT TOP 100 Convert(nvarchar,dtDate,108) AS Date, serial, nAverageUser, nMaxUser FROM tbl_ServerUser_Log ORDER BY serial DESC");
$i = 1;
while ($graph = mssql_fetch_array($graph_query)) {
$graph['nMaxUser'] = round($graph['nMaxUser'] * $percent_inc);
$graph['nAverageUser'] = round($graph['nAverageUser'] * $percent_inc);
$serie1->addPoint(new Point($graph['Date'], $graph['nMaxUser']));
$serie2->addPoint(new Point($graph['Date'], $graph['nAverageUser']));
$date = date('H:i', strtotime($graph['Date']));
$convert = json_encode(str_split($date, 5));
// $convert = str_replace('][','',$convert);
echo $convert;
}
我只想显示从手动值到从 SQL 服务器捕获的查询值的图表。
预先感谢您回答我的问题。
牛魔王的故事