Is there a shortcut for
echo "<pre>";
print_r($Array);
inside a foreach loop using laravel?I did the following
@foreach ($getallDetials as $user)
{{ print_r($user) }}
@endforeach
I get Output like
[sname] => sdsds [course] => 10 [no] => sdsd [number] => 1 ) 1 stdClass Object ( [s_no] => 2 [sname] => asasa [course] => asas [no] => asasas [number] => 1 ) 1 stdClass Object ( [s_no] => 3 [sname] => asasa [course] => asas [no] => sasa [number] => 2 )
But I don't know how can i echo '<pre>
' inside a foreach loop So i will get array as structured format.Please help me
答案 0 :(得分:1)
试试这个:
@foreach ($getallDetials as $user)
{{ $user['sname'] }}
@endforeach
laravel blade模板中的 Note:
{{ }}
内的每个内容都会回显
答案 1 :(得分:1)
当然;
public class Site
{
public string id { get; set; }
public string Sitename { get; set; }
public string website { get; set; }
}
public class Product
{
public string Name { get; set; }
public string Year { get; set; }
}
public class RootObject
{
public string retailer { get; set; }
public List<Site> sites { get; set; }
public List<Product> Products { get; set; }
}
会起作用吗?