kekos/booya-viewstate

Booya 框架的ViewState

v1.0.0 2016-03-20 19:27 UTC

This package is auto-updated.

Last update: 2024-09-09 21:15:59 UTC


README

记住用于渲染一个视图时使用的查询字符串参数,当用户从另一个视图返回到第一个视图时。

安装

您可以通过 Composer 安装 Booya ViewState

composer require kekos/booya-viewstate

API

将视图状态用作特质

use Booya\LayoutController;
use Booya\ViewState\ControllerTrait as ViewStateTrait;

class IndexController extends LayoutController {
  use ViewStateTrait;

  public function index() {
    $this->viewState();
  }

  public function other_action() {
    $this->viewState();
  }
}

在视图 index.php

<a href="index/other_action<?php echo uh($flow_qs); ?>">Go to other view</a>

在视图 other_action.php

<a href="index<?php echo uh($origin_qs); ?>">Go back to first view</a>

重定向回原始操作

$this->redirectToOrigin('index');

错误和改进

在 GitHub 问题中报告错误或随意发起拉取请求 :-)

许可协议

MIT