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

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

當(dāng)我的路線使用 laravel 斜線時(shí)如何修復(fù)未定義的變量?

當(dāng)我的路線使用 laravel 斜線時(shí)如何修復(fù)未定義的變量?

PHP
犯罪嫌疑人X 2022-07-16 18:23:52
Hellow 開發(fā)人員,我的控制器有問題,當(dāng)我嘗試訪問斜杠路由時(shí),我收到了這個(gè)錯(cuò)誤 get_the_recent_post (View: C:\xampp\htdocs\staging_project\resources\views\index.blade.php) 當(dāng)我的帳戶已注銷。但是,如果我的帳戶已登錄,則沒有發(fā)現(xiàn)錯(cuò)誤。為了更好地理解,如果我訪問此鏈接http://localhost:8000/并且我的帳戶已關(guān)閉,我收到此錯(cuò)誤未定義變量:get_the_recent_post,但是如果我訪問我的帳戶,我在數(shù)據(jù)庫(kù)中獲取的數(shù)據(jù)正在顯示。目標(biāo):如果我的路由是http://localhost:8000/ 我的輸出必須與http://localhost:8000/index上的相同我的路線:Route::get('/', function () {  return view('/index');});Route::get('/index', 'HomeController@index')->name('index');家庭控制器:   /**     * Create a new controller instance.     *     * @return void     */    // public function __construct()    // {    //     $this->middleware('auth');    // }/** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */public function index(){    $get_the_recent_post = DB::select('SELECT content_id,content_title,content_desc,when_created,content_author FROM icweb_content WHERE content_status = ? AND MONTH(when_created) = MONTH(CURDATE()) ORDER BY when_created DESC LIMIT 3',[        'Approved'    ]);    $get_the_upcoming_event = DB::select('SELECT ic_content.content_id,content_title,content_desc,content_author,start_event,end_event,when_created FROM icweb_content as ic_content         WHERE content_status = ? AND  start_event = CURDATE() AND end_event >= CURDATE() ORDER BY when_created DESC LIMIT 3        ',[            'Approved'        ]);    return view('/index')    ->with('get_the_recent_post',$get_the_recent_post)    ->with('get_the_upcoming_event',$get_the_upcoming_event);}index.blade.php:    @foreach($get_the_recent_post as $data_recent_post)        <a href="" style="text-decoration: none;">          <div style="line-height: 2px;">            <h5 class="card-title" style="font-weight: 500; font-size:13px;  color:black;">{{$data_recent_post->content_title}}</h5>            <p class="card-text" style="color:#757a91; font-size:12px; font-weight: 500;">{{strip_tags($data_recent_post->content_desc)}} </p>          </div>        </a>   @endforeach
查看完整描述

3 回答

?
肥皂起泡泡

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

為了解決我的問題:


我注釋掉這個(gè)函數(shù)


// public function __construct()

// {

//     $this->middleware('auth');

// }


查看完整回答
反對(duì) 回復(fù) 2022-07-16
?
楊魅力

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

只需像下面共享的代碼片段一樣更改您的路線。


Route::get('/', function () {

  return redirect()->route('index');

});


查看完整回答
反對(duì) 回復(fù) 2022-07-16
?
茅侃侃

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

改變你的路線,然后點(diǎn)擊。

例子:-Route::get('/', 'HomeController@index');

如果這個(gè)不起作用,則需要調(diào)試。


查看完整回答
反對(duì) 回復(fù) 2022-07-16
  • 3 回答
  • 0 關(guān)注
  • 139 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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