Handlers

更新时间:
复制 MD 格式

A handler is the method in your PHP function code that processes requests. When Function Compute invokes your function, it runs the handler method you configured.

Handler naming

PHP handlers must follow the <filename>.<methodname> format — without the .php extension.

For example, if your file is named main.php and the entry method is handler, set the Request Handler value to main.handler.

Set the handler in the console

  1. Open the Function Compute console and go to your function.

  2. Find the Request Handler field.

  3. Enter the handler name in <filename>.<methodname> format.

  4. Save the configuration.

Handler types

Function Compute supports two handler types:

Handler typeTriggerReference
Event handlerEvent sourcesEvent handlers
HTTP handlerHTTP triggersPHP HTTP functions

Configuration requirements differ between handler types. For an overview of both function types, see Function types.

What's next