drewpereli/flasher 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drewpereli/flasher

Composer 安装命令:

composer require drewpereli/flasher

包简介

Flash messages for php

README 文档

README

This is a very small package that makes it easy to implement flash message.

Installation

Install with composer.

composer require drewpereli/flasher

Or download the source from github.

Usage

Flasher is super easy to use! On any php file you'd like to use flahser in, include it by requiring the composer autoloader.

require_once "path/to/vendor/autoload.php";

If you're not using composer, simply include or require the file "flasher.php" in any file that uses the flasher.

require_once "path/to/flasher/flasher.php";

To set and get flash messages, create a new flasher object.

$flasher = new Flasher();

You can create a new flasher object at the top of each file that needs the flasher. The new object will have access to any flash messages set by any other existing or previous flasher object.

Set messages like this:

$flasher->set("message type", "your message here!"); //Sets message of type "message type" to "your message here".

Get messages like this:

$flasher->get("message type"); //Returns message of type "message type" (if there is one), and unsets it.

As soon as you "get" a message, it will be removed.

You can also use magic methods!

$flasher->message_type = "your message here!";
$message = $flasher->message_type; //"Your message here!"
$message = $flasher->message_type; //null

Full method list

  • set(type, message): Sets message of "type" to "message".
  • get(type): Returns and unsets the message of "type".
  • getAll(): Returns an array of all messages, indexed by type. Unsets all messages.
  • peek(type): Returns the message of "type" without unsetting it.
  • flash(type): Equivalent to "echo get(type);".
  • has(type): Returns true if a message of "type" has been set. Otherwise returns false.
  • hasAny(): Returns true if a flash message of any type is currently set. Otherwise returns false.

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固