承接 hasan-22/open 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

hasan-22/open

最新稳定版本:v1.0.0

Composer 安装命令:

composer require hasan-22/open

包简介

It reads the whole file and you can perform a series of operations on it

README 文档

README

It reads the whole file and you can perform a series of operations on it

It is very easy to use

Install

 composer require hasan-22/open

Functions

Function Return Description Example
ready Object of class Open Checks that the class it creates has not already been created
open Object of class Open Open file as array open('filePath.txt')
write Object of class Open Writes the changes to the file
readLines array Returns an array of file lines
getString string It converts the lines of the file that has been converted into an array into a string and returns it
getLine string Returns a particular line from the file getLine(2)
firstLine string get the first line of the file
lastLine string get the last line of the file
between array Taking lines between two lines between(3,10)
append Object of class Open Adds the new word to the end of the file append('word1','word2',....)
appendTo Object of class Open Adds the new word after the selected line of the file appendTo('new word',3)
prepend Object of class Open Adds the new word to the beginning of the file prepend('word1','word2',....)
prependTo Object of class Open Adds the new word to the beginning of the selected line of the file prependTo('new word',4)
clean Object of class Open Remove null or empty line
deleteLine Object of class Open Delete a specific line deleteLine(2)
emptyFile Object of class Open It empties the file
fileSize string Returns the size of the file

For example, we want to add some text to our file


$file = \Open\Open::ready();

$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->prepend('word3','word4')
->prependTo('word5',2)
->clean()
->write();

or 

We want to add text to our file and then receive a array output

$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->prepend('word3','word4')
->prependTo('word5',2)
->clean()
->write()->readLines();

print_r($result);

Sample output
[
    [0] => word3
    [1] => word4
    [2] => word5
    [3] => word
    [4] => word1
    [5] => word2
]

!!!! If you want to just get the output without writing to the file, omit the write() method. !!!!

For example

$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->readLines();

print_r($result);

Sample output
[
    [0] => word
    [1] => word1
    [2] => word2
]

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固