CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 徽标和商标
  • 商业解决方案
  • 纪念品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与
    • 问题 (Github)
    • 烘焙坊
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 通讯
    • 领英
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • 缓存
    • 集合
    • 命令
    • 控制台
    • 控制器
    • 核心
    • 数据库
    • 数据源
    • 错误
    • 事件
    • 表单
    • HTTP
    • 国际化
    • 日志
    • 邮件
    • 网络
    • ORM
    • 路由
      • 异常
      • 中间件
      • 路由
    • 测试套件
    • 实用工具
    • 验证
    • 视图

类 AssetMiddleware

处理在开发模式下提供插件资源。

这应该不应用于生产环境,因为它与使用真正的 Web 服务器提供文件相比,性能较差。

命名空间: Cake\Routing\Middleware

属性摘要

  • $cacheTime protected
    字符串

    缓存资源的时间长度。

方法摘要

  • __construct() public

    构造函数。

  • _getAssetFile() protected

    根据 URL 构建资源文件路径

  • deliverAsset() protected

    向客户端发送资源文件

  • isNotModified() protected

    检查未修改标头。

  • process() public

    如果路径匹配一个,则提供资源。

方法详细

__construct() ¶ public

__construct(array<string, mixed> $options = [])

构造函数。

参数
array<string, mixed> $options 可选

要使用的选项

_getAssetFile() ¶ protected

_getAssetFile(string $url): string|null

根据 URL 构建资源文件路径

参数
string $url

资源 URL

返回值
string|null

deliverAsset() ¶ protected

deliverAsset(Psr\Http\Message\ServerRequestInterface $request, SplFileInfo $file): Cake\Http\Response

向客户端发送资源文件

参数
Psr\Http\Message\ServerRequestInterface $request

要使用的请求对象。

SplFileInfo $file

文件的 file wrapper。

返回值
Cake\Http\Response

isNotModified() ¶ protected

isNotModified(Psr\Http\Message\ServerRequestInterface $request, SplFileInfo $file): bool

检查未修改标头。

参数
Psr\Http\Message\ServerRequestInterface $request

要检查的请求。

SplFileInfo $file

要比较的文件对象。

返回值
布尔值

process() ¶ public

process(ServerRequestInterface $request, RequestHandlerInterface $handler): Psr\Http\Message\ResponseInterface

如果路径匹配一个,则提供资源。

处理传入的服务器请求以生成响应。如果无法自行生成响应,它可以委托给提供的请求处理程序来执行此操作。

参数
ServerRequestInterface $request

请求。

RequestHandlerInterface $handler

请求处理程序。

返回值
Psr\Http\Message\ResponseInterface

属性详细

$cacheTime ¶ protected

缓存资源的时间长度。

类型
字符串
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 徽标和商标
  • 社区
  • 参与
  • 问题 (Github)
  • 烘焙坊
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 通讯
  • 领英
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成