我制作了一个脚本来监控来自某些VPS的数据,这些VPS存储在MySQL数据库中。
foreach($data['sitename.com'] as $d)
echo $d['loadavrg'];
我想按主机名分隔数据,以便我可以像下面的例子一样阅读:
$result = mysql_query("SELECT * FROM data WHERE hostname='sitename.com'");
$data = array();
while ($row = mysql_fetch_array($result)) {
$data[] = array(
'sitename.com' => array(
'id' => $row['id'],
'loadavrg' => $row['load average']
)
);
}
我已尝试使用以下代码(仅用于测试),但无效:
Note: currently I am creating a Mini Library Project using the support submodule project.I have synced with submodule to Mini Project and run project and saw output successfully. now, am converting main project as a library. I have removed application plugin and comment launcher in manifest and application id also.( In this MiniProject having two jars in libs folder, one for Ksoap, and another one jar.)
GITHUB PART: then, I uploaded this library project to Github.
Jitpack PART: then, using git, I synced this git code into Jitpack repository and created dependency URL from Jitpack using public url.
Final: finally I have synced this library jitpack url into New Project. It could not synced. getting error like this..
Error:Module 'com.github.vh*******v:MyApp3:-SNAPSHOT' depends on one or more Android Libraries but is a jar.
我只是错过了实现它的正确方法和语法:X
答案 0 :(得分:3)
每个元素都应添加为'sitename.com'
:
while ($row = mysql_fetch_array($result)) {
$data['sitename.com'][] = array(
'id' => $row['id'],
'loadavrg' => $row['load average']
);
}
答案 1 :(得分:2)
试试这个,
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dayName("2016-12-02 00:00:00", "YYYY-MM-DD HH:MM:ss")
}
public static String dayName(String inputDate, String format){
Date date = null;
try {
date = new SimpleDateFormat(format).parse(inputDate);
} catch (ParseException e) {
e.printStackTrace();
}
return new SimpleDateFormat("EEEE", Locale.ENGLISH).format(date);
}