Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
O código a seguir cria uma tarefa que será enviada como uma solicitação POST ao gerenciador /worker do aplicativo. A tarefa contém dados de nome e ação e será processada pela fila padrão:
Também é possível adicionar tarefas em lote a uma fila. Basta usar PushQueue. No exemplo a seguir, dois objetos PushTask são adicionados a uma PushQueue pelo método addTasks().
$task1 = new PushTask('/someUrl');$task2 = new PushTask('/someOtherUrl');$queue = new PushQueue();$queue->addTasks([$task1, $task2]);
Ao usar PushTask e PushQueue, inclua estas instruções na parte superior do arquivo PHP:
use google\appengine\api\taskqueue\PushTask;use google\appengine\api\taskqueue\PushQueue;
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[[["\u003cp\u003eThis page provides instructions on using legacy bundled services and APIs, specifically within the first-generation runtimes of the App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eA task can be created and sent as a POST request to a designated handler using the \u003ccode\u003ePushTask\u003c/code\u003e class, including the name and action parameters that will be processed by the default queue.\u003c/p\u003e\n"],["\u003cp\u003eMultiple tasks can be added in bulk to a queue by creating \u003ccode\u003ePushTask\u003c/code\u003e objects and using the \u003ccode\u003eaddTasks()\u003c/code\u003e method within the \u003ccode\u003ePushQueue\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the \u003ccode\u003ePushTask\u003c/code\u003e and \u003ccode\u003ePushQueue\u003c/code\u003e classes, you must include specific \u003ccode\u003euse\u003c/code\u003e statements at the beginning of your PHP file.\u003c/p\u003e\n"]]],[],null,["# A PHP Task Queue Example\n\nThe following code creates a task that will be sent as a POST request to the `/worker` handler of the application. The task contains name and action data, and will be processed by the default queue:\n| This page describes how to use the legacy bundled services and APIs. This API can only run in first-generation runtimes in the App Engine standard environment. If you are updating to the App Engine PHP 7/8 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/php-differences) to learn about your migration options for legacy bundled services.\n\n\u003cbr /\u003e\n\n $task = new PushTask(\n '/worker',\n ['name' =\u003e 'john doe', 'action' =\u003e 'send_reminder']);\n $task_name = $task-\u003eadd();\n\nYou can also add tasks in bulk to a queue using [PushQueue](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.taskqueue.PushQueue). In the following example, two [PushTask](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.taskqueue.PushTask) objects are added to a [PushQueue](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.taskqueue.PushQueue) using the `addTasks()` method. \n\n $task1 = new PushTask('/someUrl');\n $task2 = new PushTask('/someOtherUrl');\n $queue = new PushQueue();\n $queue-\u003eaddTasks([$task1, $task2]);\n\nWhen you use `PushTask` and `PushQueue`, include these statements at the top of your PHP file: \n\n use google\\appengine\\api\\taskqueue\\PushTask;\n use google\\appengine\\api\\taskqueue\\PushQueue;"]]