gpt4 book ai didi

html - 如何在laravel Blade 内显示iframe

转载 作者:行者123 更新时间:2023-12-04 14:45:19 26 4
gpt4 key购买 nike

我一直在研究一个纯 Vanilla html 和 php 的项目,我想将它转移到 Laravel。现在,当我想在另一个页面(另一个 Blade 文件)中显示 iframe( Blade 文件)时,我卡住了。父页面正在显示,但 iframe 带来 404(未找到)错误。下面是我的代码:

请注意,这两个文件位于“view”目录中的同一文件夹中。

parent.blade.php
<iframe src="child.blade.php">Your browser isn't compatible</iframe>
路线

Route::group(['prefix' => 'parent'], function () {
Route::get('/', 'ParentController@index');
Route::get('/child', 'ParentController@child');
});

Controller
public function index()
{
return view('folder/index');
}

public function child()
{
return view('folder/child');
}

最佳答案

它应该是路由的 URL 而不是 View 路径:

//parent.blade.php

<iframe src="{{url('parent/child')}}">Your browser isn't compatible</iframe>

关于html - 如何在laravel Blade 内显示iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60547514/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com