php8.5
Home/ Manual/ yaf / yaf_dispatcher/ Yaf_Dispatcher::disableView

Yaf_Dispatcher::disableView

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Disable view rendering

Description

Yaf_Dispatcher::disableView(): Yaf_Dispatcher|null

Turn off view rendering. This is typically used for actions that generate their own output, such as actions returning JSON data.

Parameters Parameters

Return Values

Returns the Yaf_Dispatcher object itself on success, or null if the application is not initialized.

Examples

Yaf_Dispatcher::disableView example

php
<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");

// Turn off view rendering globally, every action is expected to produce
// its output itself (e.g. a JSON API service).
Yaf_Dispatcher::getInstance()->disableView();

$app->run();
?>

See Also

  • Yaf_Dispatcher::enableView
  • Yaf_Dispatcher::autoRender

Source: reference/yaf/yaf_dispatcher/disableview.xml · from the official PHP manual (php/doc-en)