Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed May 26, 2017
1 parent f637eac commit 2a495f5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/StorageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,9 @@ protected function error($message)
*/
protected function formatPath($path, $filename)
{
$time = time();
$partials = explode('-', date('Y-y-m-d-H-i-s'));
$replacement = ['{yyyy}', '{yy}', '{mm}', '{dd}', '{hh}', '{ii}', '{ss}', '{filename}', '{time}'];
$path = str_replace($replacement, array_merge($partials, [$filename, $time]), $path);
$replacement = array_merge(explode('-', date('Y-y-m-d-H-i-s')), [$filename, time()]);
$placeholders = ['{yyyy}', '{yy}', '{mm}', '{dd}', '{hh}', '{ii}', '{ss}', '{filename}', '{time}'];
$path = str_replace($placeholders, $replacement, $path);

//替换随机字符串
if (preg_match('/\{rand\:([\d]*)\}/i', $path, $matches)) {
Expand Down

0 comments on commit 2a495f5

Please sign in to comment.