grithin/file-include 问题修复 & 功能扩展

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

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

grithin/file-include

Composer 安装命令:

composer require grithin/file-include

包简介

Include files in isolated context with options

关键字:

README 文档

README

For including files in an isolated context, but with injected variables, and potentially extracted variables.

composer require grithin/file-include

Use

use \Grithin\FileInclude;
# inject `bob` into the file context, so file code can access $bob
FileInclude::include('file.php', ['bob'=>$bob]);

# inject the global $bob into the file
global $bob;
FileInclude::require_once('file2.php', null, ['globals'=>['bob']]);

Extraction

Extraction will adjust the return value. Whereas, normally, the return value is the return of the file, when variables are being extracted, the return changes into an array, where the normal return can be found in ['_return'=>$x]

file.php

$bob = 'bob';
return 123;
$result = FileInclude::include_once('file.php', null, ['extract'=>['bob']]);
/*>
[
	'_return'=>123,
	'bob'=>'bob'
]
*/

Notes

This is a rewrite and selection from \Grithin\Files in phpbase

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固