Heim > Fragen und Antworten > Hauptteil
Ich habe Probleme bei der lokalen Verwendung von Bootstrap, wenn ich Bootstrap wie folgt verwende:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
Es lädt sehr schnell, aber wenn ich Bootstrap herunterlade und es lokal im öffentlichen Ordner verwende, so:
<link rel="stylesheet" href="{{ asset('bootstrap/css/bootstrap.min.css') }}" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
Ich erhalte die Fehlermeldung „Maximale Ausführungszeit 60 Sekunden überschritten“, der Ordner ist korrekt in „public/bootstrap/css/bootstrap.min.css“ abgelegt, wie kann ich das beheben?
Das ist meine index.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <taylor@laravel.com> */ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */ require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__ . '/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);
P粉2698479972024-03-27 09:16:11
尝试使用 npm 安装它并使用 Laravel Mix 编译它。这非常容易做到。
在您的控制台中
npm install bootstrap
npm update
在您的/resources/js/app.js
import 'bootstrap'; import 'bootstrap/dist/css/bootstrap.min.css';
最后,在您的 /resources/views/layout.blade.php
现在,我们可以像这样编译脚本:
npm run dev
第一次尝试就为我工作了。