我有一个数组对象数据数组,但是尝试在视图中打印时出现错误。这是我的数据:
Array ( [0] => stdClass Object ( [id] => 2 [user_id] => 4 [user_name] => Infinity Resort [listing_name] => 200 Hour Yoga Teacher Training [course] => 200 Hour Yoga Teacher Training [course_duration] => [retreat_type] => Featured [start_date] => [end_date] => [last_day_to_register] => [contact_person] => Infinity Resort [website] => http://bookyogatrips.com [contact_number] => 265478541 [address1] => Kathmandu ,Bagmati Nepal 4460 [address2] => [country] => Thailand [country_id] => 217 [state] => Bangkok [state_id] => 3528 [city] => Bangkok [pincode] => 44600 [rooms_type] => [overview] =>
hjkhjkhj
[program_description] =>
kjhkjhkhj
[curriculum] =>
hjkjhk
[why_choose] => [area_destination] =>
hkjhkhjk
[location] => [about_food] =>
hjkjhkjhk
[program_special] => [inclusions] => [food] => Vegetarian,Vegan [accommodaion_image] => [currency] => [itineraries] => [local_info] => [weather_information] => [seasonal_information] => [meta_title] => [meta_description] =>
hkjhkjhkh
[meta_keyword] =>
ghjghj
[service_type] => Yoga TTC [course_cat] => 2 [media] => 101839ManasluTrek.jpg [approved] => 1 [created_at] => 2018-11-14 10:41:50 [updated_at] => 2018-11-14 10:41:50 [_token] => ) )
如何在Laravel视图中打印此数据?
答案 0 :(得分:1)
请尝试以下代码
foreach ($objdata as $data) {
$data = (array) $data
// now $data is array
}
答案 1 :(得分:0)
如果是对象数组,则可以尝试以下代码:
foreach($arrayObjects as $object){
...
$object->id;
$object->user_id;
...
}