返回我的变量$ data时,我有以下内容;
{
"Test Location":
[{"name":"Kieran","round":"Test Location"},{"name":"Jordan","round":"Test Location"}],
"Location 2":
[{"name":"Paul Sample","round":"Location 2"}]
}
如何输出此示例中的唯一键
我试过
<ul>
@foreach($rounds as $r => $name)
<li>{{ $name }}</li>
@endforeach
</ul>
但是这给了我钥匙内的数据。
希望我有意义。
答案 0 :(得分:1)
您可以尝试:
<ul>
@foreach($rounds as $r => $name)
<li>{{ $r }}</li>
@endforeach
</ul>
在@foreach($rounds as $r => $name)
中,$r
是关键,$name
是值。
答案 1 :(得分:0)
数据集包含Thread
,因此您需要迭代数据集两次。
试试这个:
class Example extends JPanel{
public Dimension getPreferredSize(){
return new Dimension(500, 500);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
draw(g);
}
public void draw(Graphics g){
BufferedImage temp1;
BufferedImage temp2;
try{
temp1 = ImageIO.read(new File("C:\\Users\\Owner\\Desktop\\test1.png"));
temp2 = ImageIO.read(new File("C:\\Users\\Owner\\Desktop\\test2.png"));
}catch(IOException e){
temp1 = null;
temp2 = null;
}
final BufferedImage image1 = temp1;
final BufferedImage image2 = temp2;
Thread drawThread = new Thread(new Runnable(){
public void run(){
g.drawImage(image1, 0, 0, null);
try{
Thread.sleep(100);
}catch(InterruptedException e){
// omitted
}
g.drawImage(image2, 0, 0, null);
try{
Thread.sleep(100);
}catch(InterruptedException e){
// omitted
}
}
});
drawThread.start();
}
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new B());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
}