gpt4 book ai didi

PHP 文件由浏览器下载,而不是由 Laravel 项目处理

转载 作者:行者123 更新时间:2023-12-04 13:22:41 24 4
gpt4 key购买 nike

当我尝试运行我的项目时,它会下载一个包含以下代码的文件。我不知道这背后的原因是什么。请指导我解决这个问题

<?php

/**
* Laravel - A PHP Framework For Web Artisans
*

* @package Laravel
* @author
Taylor Otwell <taylor@laravel.com>

*/

/*
|--------------------------------------------------------------------------
|
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 nice to relax.
|
*/

require __DIR__.'/../bootstrap/autoload.php';

/*
|--------------------------------------------------------------------------
|
Turn On The Lights
|--------------------------------------------------------------------------
|
|
We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and g
ets 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);

最佳答案

您的服务器配置未设置为将 .php 文件作为 php 脚本执行,而只是将内容显示为纯文本。检查服务器的配置。

关于PHP 文件由浏览器下载,而不是由 Laravel 项目处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47987208/

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