PHP code example of lyhiving / quickio
1. Go to this page and download the library: Download lyhiving/quickio library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lyhiving / quickio example snippets
// ving\quickio\quickio;
$glob = quickio::glob('./logs');
// $glob = quickio::glob('./logs',true); //如需读取文件夹
while ($glob->valid()) {
// 当前文件
$filename = $glob->current();
echo $filename . PHP_EOL;
// 指向下一个,不能少
$glob->next();
}
$glob = quickio::read('./logs/jd.log');
while ($glob->valid()) {
// 当前行文本
$line = $glob->current();
// 逐行处理数据
echo $line . PHP_EOL;
// 指向下一个,不能少
$glob->next();
}
$lines = quickio::reads('./logs/jd.log', 3, 1);
var_dump($lines);
$ret = quickio::copy('./logs/jd.log','./logs/jd.log.new');
var_dump($ret);
$ret = quickio::rmdir('./logs/abc');
var_dump($ret);
echo "---set cache path---" . PHP_EOL;
quickio::setCachePath('./cache/');
var_dump(quickio::getCachePath());
echo "---set cache data---" . PHP_EOL;
quickio::set('p2', __FILE__);
echo "---get cache data---" . PHP_EOL;
$cache = quickio::get('p2');
var_dump($cache);
echo "---delete cache data---" . PHP_EOL;
quickio::del('p2');
echo "---no cache output---" . PHP_EOL;
quickio::noCache();
echo "---browser cache output---" . PHP_EOL;
quickio::ieCache(600);
echo "---quick dump output---" . PHP_EOL;
quickio::dump([__FILE__,__LINE__]);
echo "---quick dump output end exit ---" . PHP_EOL;
quickio::_dump([__FILE__,__LINE__]);
$ret = quickio::rmdir('./logs/abc');
var_dump($ret);
quickio::CORS('*');
$data = quickio::url('get','https://httpbin.org/get',[],['file_get_contents'=>false]);
var_dump($data);
$data = quickio::url('post','http://httpbin.org/post',['date'=>date('Y-m-d H:i:s')],['file_get_contents'=>true]);
var_dump($data);
quickio::output('RUN First! You can see this.');
echo "YOU CAN'T SEE ME! ". PHP_EOL;
echo "BUT YOU CAN RUN OTHER THINGS ". PHP_EOL;