CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 企业解决方案
  • 周边商品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与进来
    • 问题(GitHub)
    • 烘焙坊
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • 领英
    • 优酷
    • 脸书
    • 推特
    • 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
    • 路由
    • 测试套件
    • 实用工具
    • 验证
    • 视图

类 ControllerFactory

用于为请求构建控制器的工厂方法。

命名空间: Cake\Controller

属性摘要

  • $container protected
    Cake\Core\ContainerInterface
  • $controller protected
    Cake\Controller\Controller

方法摘要

  • __construct() public

    构造函数

  • coerceStringToType() protected

    将字符串参数强制转换为基本类型。

  • create() public

    为给定的请求创建一个控制器。

  • getActionArgs() protected

    获取控制器操作调用参数。

  • getControllerClass() public

    根据当前请求和控制器参数确定控制器类名

  • handle() public

    调用操作。

  • invoke() public

    调用控制器的操作和包装方法。

  • missingController() protected

    当控制器丢失时抛出异常。

方法详情

__construct() ¶ public

__construct(Cake\Core\ContainerInterface $container)

构造函数

参数
Cake\Core\ContainerInterface $container

用于构建控制器的容器。

coerceStringToType() ¶ protected

coerceStringToType(string $argument, ReflectionNamedType $type): array|string|float|int|bool|null

将字符串参数强制转换为基本类型。

参数
string $argument

要强制转换的参数

ReflectionNamedType $type

参数类型

返回
array|string|float|int|bool|null

create() ¶ public

create(Psr\Http\Message\ServerRequestInterface $request): Cake\Controller\Controller

为给定的请求创建一个控制器。

参数
Psr\Http\Message\ServerRequestInterface $request

用于构建控制器的请求。

返回
Cake\Controller\Controller
抛出
Cake\Http\Exception\MissingControllerException

getActionArgs() ¶ protected

getActionArgs(Closure $action, array $passedParams): array

获取控制器操作调用参数。

参数
Closure $action

控制器操作。

array $passedParams

由路由器传递的参数。

返回
array

getControllerClass() ¶ public

getControllerClass(Cake\Http\ServerRequest $request): class-stringCake\Controller\Controller>|null

根据当前请求和控制器参数确定控制器类名

参数
Cake\Http\ServerRequest $request

用于构建控制器的请求。

返回
class-stringCake\Controller\Controller>|null

handle() ¶ public

handle(ServerRequestInterface $request): Psr\Http\Message\ResponseInterface

调用操作。

可以调用其他协作代码来生成响应。

参数
ServerRequestInterface $request

请求实例。

返回
Psr\Http\Message\ResponseInterface

invoke() ¶ public

invoke(mixed $controller): Psr\Http\Message\ResponseInterface

调用控制器的操作和包装方法。

参数
mixed $controller

要调用的控制器。

返回
Psr\Http\Message\ResponseInterface
抛出
Cake\Controller\Exception\MissingActionException
如果找不到控制器操作。
UnexpectedValueException
如果操作方法的返回值不是 null 或 ResponseInterface 实例。

missingController() ¶ protected

missingController(Cake\Http\ServerRequest $request): Cake\Http\Exception\MissingControllerException

当控制器丢失时抛出异常。

参数
Cake\Http\ServerRequest $request

请求。

返回
Cake\Http\Exception\MissingControllerException

属性详情

$container ¶ protected

类型
Cake\Core\ContainerInterface

$controller ¶ protected

类型
Cake\Controller\Controller
OpenHub
Pingping
Linode
  • 企业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与进来
  • 问题(GitHub)
  • 烘焙坊
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • 领英
  • 优酷
  • 脸书
  • 推特
  • Mastodon
  • 帮助与支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成