PHP 8.6.0 Beta 3 is available for testing

Yaf_Controller_Abstract::getInvokeArg

(Yaf >=1.0.0)

Yaf_Controller_Abstract::getInvokeArgRetrieve one action invocation argument

Опис

public function Yaf_Controller_Abstract::getInvokeArg(string $name): ?string

Returns a single invocation argument of the current action, given its name. Invocation arguments are passed to the action through Yaf_Controller_Abstract::forward().

Параметри

name

The name of the invocation argument to retrieve.

Значення, що повертаються

The argument value, or null if it does not exist.

Приклади

Приклад #1 Yaf_Controller_Abstract::getInvokeArg() example

<?php
class UserController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        // forward to the profile action of this controller,
        // carrying invocation arguments
        $this->forward("profile", array("name" => "laruence"));
        return false; // ends the current flow
    }

    public function profileAction() {
        // retrieve one invocation argument by name
        var_dump($this->getInvokeArg("name"));
        var_dump($this->getInvokeArg("missing"));
    }
}
?>

Поданий вище приклад виведе щось схоже на:

string(8) "laruence"
NULL

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top