第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在控制器中構(gòu)建 div 并將其放置在需要的頁(yè)面上

如何在控制器中構(gòu)建 div 并將其放置在需要的頁(yè)面上

PHP
嗶嗶one 2021-11-13 16:11:13
我正在查詢(xún)數(shù)據(jù)庫(kù)中的位置。我從存儲(chǔ)過(guò)程得到響應(yīng)。當(dāng)它返回結(jié)果時(shí),我想構(gòu)建卡片/文章/表單/等。從結(jié)果并放置在頁(yè)面上的容器內(nèi)。我知道如何回顯一段 div 但它位于頁(yè)面頂部。如何構(gòu)建這些部分,然后將它們放置在頁(yè)面中的某個(gè) div 中?這是構(gòu)建頁(yè)面的控制器的一部分。 $results = DB::select('CALL Finder(?, ?, ?, ?)', array($latDown,       $latUp, $longDown, $longUp)); foreach($results as $result){     //Here is where I want to build the divs }這是帶有結(jié)果部分的 html 的blade.php 文件@extends('layouts.mainlayout')@section('content')<div class="container" style="height 55rem;"><div class="row">    <div class="col" id="locations_results" style="overflow-y: auto; width: 40%; height: 55rem;">        <!--Here is where I want the results to go-->    </div>    <div class="col" style="">        @include('layouts.map')    </div></div>我不知道該嘗試什么,而且我的谷歌搜索效果不佳。任何幫助深表感謝。
查看完整描述

1 回答

?
拉莫斯之舞

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超10個(gè)贊

你不應(yīng)該在控制器中構(gòu)建你的 html。由于這是您第一次使用刀片,我將在下面提供一個(gè)簡(jiǎn)單的示例。


首先,將數(shù)據(jù)從控制器傳遞到視圖。


$results = ...(your query)...


return view('your-view', compact('results'));

然后使用刀片指令(例如,@foreach)在視圖中構(gòu)建您的結(jié)果。


@extends('layouts.mainlayout')

@section('content')


<div class="container" style="height 55rem;">

<div class="row">

    <div class="col" id="locations_results" style="overflow-y: auto; width: 40%; height: 55rem;">


        <!--Here is where I want the results to go-->


        @foreach ($results as $result)


            <!-- Use double curly braces for showing variable data -->

            {{ $result->id }}


        @endforeach


    </div>

    <div class="col" style="">

        @include('layouts.map')

    </div>

</div>


查看完整回答
反對(duì) 回復(fù) 2021-11-13
  • 1 回答
  • 0 關(guān)注
  • 176 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)