我知道Swift相对较新,但我想知道是否有办法确定设备类型?
(就像你曾经能够做到的那样#define)?
主要是我想知道如何区分OS X或iOS.我在这个问题上一无所获.
将JSON数据存储在MySQL表行中是否可以接受?我需要将数组存储在mysql数据库中.问题是,我不知道每个用户需要多少列.所以我想将JSON存储在一个以arrayexemple 命名的行中.这是最好的方法吗?
编辑:
另外,我使用的text是表列类型.
我使用PHP代码来获得Stack Overflow的声誉.
$feed = json_decode(file_get_contents("http://api.stackexchange.com/2.1/users/22656?order=desc&sort=reputation&site=stackoverflow&filter=!*MxOyD8qN0Yghnep", true), true);
$array = $feed['items'][0];
$rep = $array['reputation'];
echo $rep;
Run Code Online (Sandbox Code Playgroud)
但我得到null了饲料.此外,用户帐户是Jon Skeet,这是我获取ID 22656的地方.我该如何解决这个问题?
我在Java中有这样的类:
public class Wrapper {
public static List<Type> list;
@Override
public String toString() {
return "List: " + this.list;
}
public static void main(String[] args) {
Wrapper w = new Wrapper();
System.out.println(w);
}
}
Run Code Online (Sandbox Code Playgroud)
和这样的一个类:
public class Type {
private static String name;
public Type(String n) {
this.name = n;
}
@Override
public String toString() {
return this.name;
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了数组中每个项目的最后一项的名称,而不是获取每个项目的名称.有什么建议?