- 我们有这样一个需求,使用laravel-admin在目录添加一个外链,要求点击外链以iframe嵌入到laravel-admin显示。
- 我们在app/Admin/routes.php里面加入跳转路由,同时在laravel-admin后台加上目录连接并赋予连接权限,我们尝试点击之后并不是iframe嵌入显示
代码语言:javascript
复制 $router->redirect('/spider-home', 'http://xxxxx.com/login/cjweb/Msg.aspx?web=xp002');
- 我们借助一个插件快速实现目录可iframe嵌套
- 进入项目所在目录,命令行依次执行以下代码(安装composer)
- 如果提示
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 75497472 bytes)
,PHP脚本使用的内存已经超过了系统对其设置的允许最大内存
- 查询你的composer安装路径
- 临时php的允许最大内存 (
memory_limit=-1 表示不限制
)
代码语言:javascript
复制[root@VM-40-48-centos]# whereis composer
composer: /usr/local/bin/composer
代码语言:javascript
复制 composer require ichynul/iframe-tabs //不提示最大内存使用
php -d memory_limit=-1 /usr/local/bin/composer require ichynul/iframe-tabs //提示最大内存使用
php artisan vendor:publish --tag=iframe-tabs
php artisan admin:import iframe-tabs
代码语言:javascript
复制 'extensions' => [
'iframe-tabs' => [
// Set to `false` if you want to disable this extension
'enable' => true,
// The controller and action of dashboard page `/admin/dashboard`
'home_action' => AppAdminControllersHomeController::class . '@index',
// Default page tab-title
'home_title' => 'Home',
// Default page tab-title icon
'home_icon' => 'fa-home',
// Whether show icon befor titles for all tab
'use_icon' => true,
// dashboard css
'tabs_css' =>'vendor/laravel-admin-ext/iframe-tabs/dashboard.css',
// layer.js path
'layer_path' => 'vendor/laravel-admin-ext/iframe-tabs/layer/layer.js',
/**
* href links do not open in tab .
* selecter : .sidebar-menu li a,.navbar-nav>li a,.sidebar .user-panel a,.sidebar-form .dropdown-menu li a
* if(href.indexOf(pass_urls[i]) > -1) //pass
*/
'pass_urls' => ['/auth/logout', '/auth/lock'],
// When login session state of a tab-page was expired , force top-level window goto login page .
//登录超时是是否强制整体跳转到登录页面,设为false的话只在触发超时登录的页面跳转,最大程度保留已打开页面。
'force_login_in_top' => true,
// tabs left offset
'tabs_left' => 42,
// bind click event of table actions [edit / view / create]
'bind_urls' => 'popup', //[ popup / new_tab / none]
//table actions dom selecter, [view / edit / create]buttons ,and any thing has class pupop : <a class="pupop" popw="400px" poph="200px" href="someurl">mylink</a>
'bind_selecter' => 'a.grid-row-view,a.grid-row-edit,.column-__actions__ ul.dropdown-menu a,.box-header .pull-right .btn-success,.popup',
//layer popup size
'layer_size' => '1100px,98%',
// if run web in `cli` mode ,for example `swoole` ,set it to true,如果是以命令行方式运行网站,如`swoole` 就设置为 true
'web_in_cli' => false
]
],
- 更多详情请移步到ichynul/iframe-tabs查看