Laravel 5.5项目下载文件Insted Of Opening Them In Browser PHP 7.1 M



我正在windows上开发laravel 5.5项目PHP 7.1.32,它运行良好。现在我转移到Mac OSX,我把整个项目从windows复制到Mac,而不是在浏览器中打开文件,它下载文件(下载(。当我把公用文件夹打到地址栏时。下载的文件内容如下

<?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(IlluminateContractsHttpKernel::class);
$response = $kernel->handle(
$request = IlluminateHttpRequest::capture()
);
$response->send();
$kernel->terminate($request, $response);

你不能只点击公共文件夹就期望通过php运行你的应用程序。首先应该为应用程序服务。

您可以在应用程序基本目录上使用phps内置的带有php artisan serve的web服务器,也可以使用apache或nginx之类的web服务器。

如果你已经为你的应用程序提供服务,那么你的服务器配置中存在错误配置,你应该提供更多信息。。

我建议宅btw.

相关内容

最新更新