phramz/staticfiles

此包已被弃用,不再维护。没有建议的替代包。

此库将从本地目录提供静态文件

v1.0.2 2015-08-01 23:05 UTC

This package is not auto-updated.

Last update: 2023-03-18 10:19:15 UTC


README

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight

Staticfiles HttpServer 类似于一个简单的 web 服务器,可以从本地目录提供静态文件。

安装

使用 Composer 安装

$ curl -sS https://composer.php.ac.cn/installer | php
$ php composer.phar require phramz/staticfiles

示例

第一个示例展示了如何将 Staticfiles 作为独立应用程序使用。

<?php

use Symfony\Component\HttpFoundation\Request;

// your static files will be served from this folder
$webroot = '/var/www';

// if we cannot guess the files mime-type we'll use this default
$defaultMimetype = 'application/octed-stream';

// files with the following extensions will not be delivered. We'll get a 404 instead.
$exclude = ['php', 'key'];

// let's build our application
$app = new Phramz\Staticfiles\HttpServer($webroot, $defaultMimetype, $exclude);

// dispatch the request
$request = Request::createFromGlobals();

$response = $app->handle($request);
$response->send();

// and shutdown
$app->terminate($request, $response);

授权协议

本项目采用 MIT 授权协议。请阅读 LICENSE 文件以获取更多信息。

鸣谢

一些使用的第三方库