krowek / view-counter-bundle
"浏览计数器"包
Requires
- php: >=7.2.5
- symfony/framework-bundle: ^2.7 || ^3.0 || ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: >5.7
- dev-master
- 4.5.3
- 4.5.2
- 4.5.1
- 4.5.0
- 4.4.6
- 4.4.0
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.6
- 3.6.5
- 3.6.4
- 3.6.3
- 3.6.2
- 3.6.1
- 3.6.0
- 3.5.0
- 3.4.3
- 3.4.2
- 3.4.0
- 3.3.1
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.8
- 3.0.7
- 3.0.6
- 2.5.0
- 2.4.0
- 2.0.0
- 1.4.6
- 1.4.5
- 1.4.0
- 1.3.8
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.1.1
- 1.1.0
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is not auto-updated.
Last update: 2024-09-25 06:50:07 UTC
README
欢迎使用 "TchoulomViewCounterBundle"。
此包用于统计网页的浏览次数(观众人数)。
此包还可以用于绘制网页统计数据的图形表示。
目录
- 特性包括
- 文档
- 安装
- 使用方法
- 工具
- 原始信用
- 许可
特性包括
- Viewcounter
- Statistics
- Geolocation
文档
安装
步骤 1:使用 composer 下载 TchoulomViewCounterBundle
您可以通过 Composer 安装它
$ php composer.phar update tchoulom/view-counter-bundle
或
$ composer require tchoulom/view-counter-bundle
或
$ composer req tchoulom/view-counter-bundle
确保它在 composer.json 文件中记录
{ "require": { ... "tchoulom/view-counter-bundle": "^4.0" ... } }
步骤 2:启用 Bundle
编辑 appKernel.php 文件
... $bundles = array( ... new Tchoulom\ViewCounterBundle\TchoulomViewCounterBundle(), ... ); ...
使用方法
步骤 1:接口和属性
假设您有一个 Article 实体。
此实体必须实现 ViewCountable 接口
use Tchoulom\ViewCounterBundle\Model\ViewCountable; ... class Article implements ViewCountable { ... }
添加 $views 属性和目标实体 ViewCounter。
$views 属性允许获取浏览次数
use Tchoulom\ViewCounterBundle\Model\ViewCountable; use Entity\ViewCounter; use Doctrine\Common\Collections\ArrayCollection; ... class Article implements ViewCountable { ... /** * @var integer * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\OneToMany(targetEntity="Entity\ViewCounter", mappedBy="article") */ protected $viewCounters; /** * @ORM\Column(name="views", type="integer", nullable=true) */ protected $views = 0; /** * Constructor */ public function __construct() { $this->viewCounters = new ArrayCollection(); } /** * Gets id * * @return integer */ public function getId() { return $this->id; } /** * Sets $views * * @param integer $views * * @return $this */ public function setViews($views) { $this->views = $views; return $this; } /** * Gets $views * * @return integer */ public function getViews() { return $this->views; } /** * Get $viewCounters * * @return Collection */ public function getViewCounters() { return $this->viewCounters; } /** * Add $viewCounter * * @param ViewCounter $viewCounter * * @return $this */ public function addViewCounter(ViewCounter $viewCounter) { $this->viewCounters[] = $viewCounter; return $this; } /** * Remove $viewCounter * * @param ViewCounter $viewCounter */ public function removeViewCounter(ViewCounter $viewCounter) { $this->viewCounters->removeElement($viewCounter); } ... }
步骤 2:ViewCounter
ViewCounter 实体允许设置 IP 地址、view_date 和 article_id。
ViewCounter 实体必须扩展 BaseViewCounter
use Tchoulom\ViewCounterBundle\Entity\ViewCounter as BaseViewCounter; /** * ViewCounter. * * @ORM\Table(name="view_counter") * @ORM\Entity() */ class ViewCounter extends BaseViewCounter { ... }
更新 ViewCounter 实体和您的 Article 实体之间的 doctrine 关系
use Tchoulom\ViewCounterBundle\Entity\ViewCounter as BaseViewCounter; /** * ViewCounter. * * @ORM\Table(name="view_counter") * @ORM\Entity() */ class ViewCounter extends BaseViewCounter { ... /** * @ORM\ManyToOne(targetEntity="Article", cascade={"persist"}, inversedBy="viewCounters") * @ORM\JoinColumn(nullable=true) */ private $article; /** * Gets article * * @return Article */ public function getArticle() { return $this->article; } /** * Sets Article * * @param Article $article * * @return $this */ public function setArticle(Article $article) { $this->article = $article; return $this; } ... }
步骤 3:配置
对于 symfony 4 或 5
- 创建文件 config/packages/tchoulom_viewcounter.yaml
- 在 tchoulom_viewcounter.yaml 文件中添加以下 viewcounter 配置。
对于低于 4 版本的 symfony
- 在 app/config.yml 文件中添加以下 viewcounter 配置。
viewcounter 配置
tchoulom_view_counter: view_counter: view_strategy: daily_view statistics: use_stats: false stats_file_name: stats stats_file_extension: geolocation: geolocator_id: App\Service\Geolocator
"view_counter"
view_strategy 的不同值包括:daily_view、unique_view、increment_each_view、hourly_view、weekly_view、monthly_view、yearly_view、view_per_minute、view_per_second。
-
daily_view 允许对于给定的 IP 地址,每天增加 Article 的浏览次数(观众人数)。实际上它是增加 $views 属性。
-
unique_view 允许将给定 IP 地址的 article 的浏览次数设置为 1
-
increment_each_view 允许每次用户刷新页面时增加 Article 的浏览次数
-
hourly_view 允许对于给定的 IP 地址,每小时增加 Article 的浏览次数(观众人数)。
-
weekly_view 允许对于给定的 IP 地址,每周增加 Article 的浏览次数(观众人数)。
-
“月度视图”允许为特定的 IP 地址,增加 文章 的浏览次数(观看量)。
-
“年度视图”允许为特定的 IP 地址,增加 文章 的浏览次数(观看量)。
-
“每分钟视图”允许为特定的 IP 地址,每分钟增加 文章 的浏览次数(观看量)。
-
“每秒视图”允许为特定的 IP 地址,每秒增加 文章 的浏览次数(观看量)。
"statistics"
“使用统计”允许选择是否使用统计功能。
如果 使用统计 设置为 true,则将使用统计功能(对应第 6 步)。
“统计文件名”允许定义统计文件的名称。
统计文件名 的默认名称为 stats。
“统计文件扩展名”允许定义统计文件的扩展名。
示例:
如果 统计文件扩展名: txt,则统计文件的默认名称将是 stats.txt。
如果 统计文件扩展名:,则统计文件的默认名称将是 stats。
统计文件的完整路径是您的项目中的 var/viewcounter。
“地理位置”
地理位置定义了一个服务,允许您定位页面访问。
地理位置标识符 对应于您地理位置服务的 标识符 或 类名,具体取决于使用的 symfony 版本。
tchoulom_view_counter: ... geolocation: geolocator_id: app.service.geolocator
或
tchoulom_view_counter: ... geolocation: geolocator_id: App\Service\Geolocator
如果您的服务被这样声明:
app.service.geolocator: class: App\Service\Geolocator
那么,您必须像本文档中所述设置您的“地理位置”服务 第 6 步:地理位置。
如果您不想在项目中使用地理位置,则必须注释掉地理位置配置。
tchoulom_view_counter: ... # geolocation: # geolocator_id: app.service.geolocator
步骤 4:控制器
有 2 种方法可供选择。
方法 1
use App\Entity\ViewCounter; use Tchoulom\ViewCounterBundle\Counter\ViewCounter as Counter; ... // For Symfony 4 or 5, inject the ViewCounter service /** * @var Counter */ protected $viewcounter; /** * @param Counter $viewCounter */ public function __construct(Counter $viewCounter) { $this->viewcounter = $viewCounter; } /** * Reads an existing article * * @Route("/read/{id}", name="read_article") * @ParamConverter("article", options={"mapping": {"id": "id"}}) * @Method({"GET", "POST"}) */ public function readAction(Request $request, Article $article) { // Viewcounter $viewcounter = $this->get('tchoulom.viewcounter')->getViewCounter($article); // For Symfony 4 or 5 $viewcounter = $this->viewcounter->getViewCounter($article); $em = $this->getDoctrine()->getEntityManager(); if ($this->viewcounter->isNewView($viewcounter)) { $views = $this->viewcounter->getViews($article); $viewcounter->setIp($request->getClientIp()); $viewcounter->setArticle($article); $viewcounter->setViewDate(new \DateTime('now')); $article->setViews($views); $em->persist($viewcounter); $em->persist($article); $em->flush(); ... } } ...
方法 2
您只需通过 'tchoulom.viewcounter' 服务保存您的 文章 实体。
... use Tchoulom\ViewCounterBundle\Counter\ViewCounter as Counter; // For Symfony 4 or 5, inject the ViewCounter service /** * @var Counter */ protected $viewcounter; /** * @param Counter $viewCounter */ public function __construct(Counter $viewCounter) { $this->viewcounter = $viewCounter; } /** * Reads an existing article * * @Route("/read/{id}", name="read_article") * @ParamConverter("article", options={"mapping": {"id": "id"}}) * @Method({"GET", "POST"}) */ public function readAction(Request $request, Article $article) { // Saves the view $page = $this->get('tchoulom.viewcounter')->saveView($article); // For Symfony 4 or 5 $page = $this->viewcounter->saveView($article); ... }
第二种方法返回当前页面($article)。
您可以根据自己的情况选择最合适的方法。
步骤 5:视图
最后,您可以显示观看次数。
... <h1>The number of views of this article :</h1> {{ article.views }} ...
步骤 6:地理位置
一些捆绑包可以用于在项目中实现地理位置系统。这些捆绑包通常使用 IP 地址来确定网页访问者的地理位置。
在本指南中,我们将使用此捆绑包,例如
gpslab/geoip2 : https://github.com/gpslab/geoip2
如果您想使用它,可以阅读有关安装和使用此捆绑包的文档。
否则,您可以根据自己的喜好使用其他地理位置捆绑包。
创建一个“地理位置服务”来管理地理位置数据
<?php namespace App\Service; use GeoIp2\Database\Reader; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Tchoulom\ViewCounterBundle\Adapter\Geolocator\GeolocatorInterface; /** * Class Geolocator * * This service must implements the "GeolocationInterface". */ class Geolocator implements GeolocatorInterface { /** * @var Request */ protected $request; /** * @var Reader */ protected $reader; /** * Geolocator constructor. * * @param RequestStack $requestStack * @param Reader $reader */ public function __construct(RequestStack $requestStack, Reader $reader) { $this->request = $requestStack->getCurrentRequest(); $this->reader = $reader; } /** * Gets the record. * * @return \GeoIp2\Model\City|mixed * @throws \GeoIp2\Exception\AddressNotFoundException * @throws \MaxMind\Db\Reader\InvalidDatabaseException */ public function getRecord() { $clientIp = $this->request->getClientIp(); return $this->reader->city($clientIp); } /** * Gets the continent. * * @return string * @throws \GeoIp2\Exception\AddressNotFoundException * @throws \MaxMind\Db\Reader\InvalidDatabaseException */ public function getContinent(): string { return $this->getRecord()->continent->name; } /** * Gets the country. * * @return string * @throws \GeoIp2\Exception\AddressNotFoundException * @throws \MaxMind\Db\Reader\InvalidDatabaseException */ public function getCountry(): string { return $this->getRecord()->country->name; } /** * Gets the region. * * @return string * @throws \GeoIp2\Exception\AddressNotFoundException * @throws \MaxMind\Db\Reader\InvalidDatabaseException */ public function getRegion(): string { return $this->getRecord()->subdivisions[0]->names['en']; } /** * Gets the city. * * @return string * @throws \GeoIp2\Exception\AddressNotFoundException * @throws \MaxMind\Db\Reader\InvalidDatabaseException */ public function getCity(): string { return $this->getRecord()->city->name; } }
您的地理位置服务必须实现 Tchoulom\ViewCounterBundle\Adapter\Geolocator\GeolocatorInterface 接口。
您可以根据需要改进上述“地理位置服务”,特别是验证地理位置数据的存在。
您可以通过 搜索地理位置数据 这一步来使用地理位置数据。
步骤 7:统计数据利用
技巧
对于 Symfony 4 或 5,注入您想要使用的服务,而不是通过容器:$this->get('tchoulom.viewcounter.stats_finder');
- 示例
use Tchoulom\ViewCounterBundle\Finder\StatsFinder: /** * @var StatsFinder */ protected $statsFinder; /** * @param StatsFinder $statsFinder */ public function __construct(StatsFinder $statsFinder) { $this->statsFinder = $statsFinder; }
StatsFinder 服务
使用 StatsFinder 服务获取网页的统计数据
// The "statsFinder" service $statsFinder = $this->get('tchoulom.viewcounter.stats_finder'); // Get all statistical data $contents = $statsFinder->loadContents(); // Finds statistics by page // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Page $page = $statsFinder->findByPage($article); // Finds statistics by year (year number: 2019) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Year $year = $statsFinder->findByYear($article, 2019); // Finds statistics by month (month number: 1) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Month $month = $statsFinder->findByMonth($article, 2019, 1); // Finds statistics by week (week number: 3) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Week $week = $statsFinder->findByWeek($article, 2019, 1, 3); // Finds statistics by day (name of the day: 'thursday') // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Day $day = $statsFinder->findByDay($article, 2019, 1, 3, 'thursday'); // Finds statistics by hour (time name: 'h17' => between 17:00 and 17:59) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Hour $hour = $statsFinder->findByHour($article, 2019, 1, 3, 'thursday', 'h17'); // Finds statistics by minute (the name of the minute: 'm49' => in the 49th minute) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Minute $minute = $statsFinder->findByMinute($article, 2019, 1, 3, 'thursday', 'h17', 'm49'); // Finds statistics by second (the name of the second: 's19' => in the 19th second) // Returns an instance of Tchoulom\ViewCounterBundle\Statistics\Second $second = $statsFinder->findBySecond($article, 2019, 1, 3, 'thursday', 'h17', 'm49', 's19');
您还可以通过 年、月、周、天、小时、分钟 和 秒 来获取网页的统计数据。
获取 年度 统计数据
// Get the yearly statistics $yearlyStats = $statsFinder->getYearlyStats($article);
结果
[ [2019,98537215], [2018,95548144], [2017,47882376] ]
2019 年,有 98537215 次观看。
2018 年,有 95548144 次观看。
2017 年,有 47882376 次观看。
获取 月度 统计数据
// Get the monthly statistics in 2019 $monthlyStats = $statsFinder->getMonthlyStats($article, 2019);
结果
[ [8,951224], [7,921548], [6,845479] ]
2019年8月(月份编号8)当月,共有951,224次浏览。
2019年7月(月份编号7)当月,共有921,548次浏览。
2019年6月(月份编号6)当月,共有845,479次浏览。
获取 周度 统计数据
// Get the weekly statistics of the month of August (month number 8) in 2019 $weeklyStats = $statsFinder->getWeeklylyStats($article, 2019, 8);
结果
[ [34,494214], [33,117649], [32,183254] ]
2019年8月(月份编号8)的第34周,共有494,214次浏览。
2019年8月第33周,共有117,649次浏览。
2019年8月第32周,共有183,254次浏览。
获取 日度 统计数据
// Get the daily statistics of the week number 33 in august 2019 $dailyStats = $statsFinder->getDailyStats($article, 2019, 8, 33);
结果
[ ['Monday',16810],['Tuesday',16804],['Wednesday',16807],['Thursday',16807],['Friday',16807],['Saturday',16807],['Sunday',16807] ]
2019年8月第33周(月份编号8)的周一,共有16,810次浏览。
2019年8月第33周(月份编号8)的周二,共有16,804次浏览。
2019年8月第33周(月份编号8)的周三,共有16,807次浏览。
...
获取 小时度 统计数据
// Get the hourly statistics for Thursday of the week number 33 in august 2019 $hourlyStats = $statsFinder->getHourlyStats($article, 2019, 8, 33, 'Thursday');
结果
[ ['00',650],['01',750],['02',500],['03',900],['04',700],['05',700],['06',700],['07',700],['08',700],['09',700],['10',700],['11',720],['12',680],['13',700],['14',200],['15',1200],['16',700],['17',700],['18',700],['19',700],['20',100],['21',1300],['22',700],['23',700] ]
2019年8月第33周(月份编号8)的周四
-
午夜时分,共有650次浏览。
-
1小时时,共有750次浏览。
-
2小时时,共有500次浏览。
-
3小时时,共有900次浏览。
-
...
获取每 分钟 统计数据
// Get the statistics per minute on Saturday of the week number 33 in august 2019 at 15h ('h15') $statsPerMinute = $this->get('tchoulom.viewcounter.stats_finder')->getStatsPerMinute($article, 2019, 8, 33, 'Saturday', 'h15');
结果
[ ['00',650],['01',740],['02',520],['03',752],['04',700],['05',700],['06',400],['07',400],['08',800],['09',700],['10',700],['11',720],['12',680],['13',700],['14',200],['15',100],['16',105],['17',700],['18',700],['19',700],['20',100],['21',130],['22',700],['23',700],['24',110],['25',210],['26',110],['27',10],['28',110],['29',10],['30',141],['31',148],['32',181],['33',141],['34',141],['35',171],['36',141],['37',181],['38',141],['39',141],['40',191],['41',193],['42',194],['43',194],['44',191],['45',191],['46',148],['47',191],['48',191],['49',191],['50',191],['51',151],['52',131],['53',191],['54',171],['55',191],['56',111],['57',191],['58',254],['59',91] ]
2019年8月第33周(月份编号8)的周六15时('h15')
-
0分钟时,共有650次浏览。
-
1分钟时,共有740次浏览。
-
2分钟时,共有520次浏览。
-
3分钟时,共有752次浏览。
-
...
获取每 秒 统计数据
// Get the statistics per second on Saturday of the week number 33 in august 2019 at 15H49 $statsPerSecond = $this->get('tchoulom.viewcounter.stats_finder')->getStatsPerSecond($article, 2019, 8, 33, 'Saturday', 'h15', 'm49');
结果
[ ['00',60],['01',40],['02',21],['03',72],['04',70],['05',70],['06',50],['07',20],['08',80],['09',70],['10',70],['11',72],['12',68],['13',70],['14',20],['15',10],['16',15],['17',70],['18',70],['19',70],['20',10],['21',13],['22',70],['23',7],['24',11],['25',21],['26',11],['27',10],['28',110],['29',10],['30',14],['31',14],['32',18],['33',14],['34',14],['35',17],['36',14],['37',18],['38',14],['39',14],['40',19],['41',19],['42',19],['43',19],['44',19],['45',19],['46',18],['47',19],['48',19],['49',19],['50',19],['51',15],['52',13],['53',19],['54',17],['55',19],['56',11],['57',19],['58',25],['59',71] ]
2019年8月第33周(月份编号8)的周六15H49
-
0秒时,共有60次浏览。
-
1秒时,共有40次浏览。
-
2秒时,共有21次浏览。
-
3秒时,共有72次浏览。
-
...
统计文件中的数据表示浏览统计数据,如下图所示
上图显示,统计数据显示包含2个“可统计浏览次数”的实体:文章和新闻。
文章实体的统计数据记录了12个月。
让我们放大查看1月份第一周的统计数据
搜索地理位置数据
访问您网页的访客地理位置数据可能如下所示
上图显示,访客已从4个国家查看网页(标识符为3):美国、法国、英国和爱尔兰。
让我们放大查看包含在“美国”中的地理位置数据以可视化
共有5次来自美国的浏览,包括4次位于哥伦比亚特区地区的华盛顿市。
这5次浏览分布在2个地区:哥伦比亚特区和纽约。
也可以使用浏览日期数据
获取国家统计数据
$countryStats = $this->statFinder->getCountryStats($article);
结果
[ ["France", 6],["United States", 45],["Ireland", 8],["United Kingdom", 8] ]
- 在法国有6次浏览。
- 在美国有45次浏览。
- ...
获取地区统计数据
$regionStats = $this->statFinder->getRegionStats($article);
结果
[ ["Île-de-France", 3],["Normandy", 3],["District of Columbia", 44],["New York", 1],["Leinster", 8],["England", 2] ]
- 在Île-de-France地区有3次浏览。
- 在诺曼底地区有3次浏览。
- 在哥伦比亚特区有44次浏览。
- ...
获取城市统计数据
$cityStats = $this->statFinder->getCityStats($article);
结果
[ ["Paris", 3],["Rouen", 3],["Washington", 44],["Buffalo", 1],["Dublin", 8],["London", 2] ]
- 在巴黎有3次浏览。
- 在鲁昂有3次浏览。
- 在华盛顿有44次浏览。
- ...
按国家获取统计数据
$statsByCountry = $this->statFinder->getStatsByCountry($article, 'United States');
结果
45
- 在“united states”国家有45次浏览。
按地区获取统计数据
$statsByRegion = $this->statFinder->getStatsByRegion($article, 'United States', 'District of Columbia');
结果
44
- 在“District of Columbia”地区有44次浏览。
按城市获取统计数据
$statsByCity = $this->statFinder->getStatsByCity($article, 'United States', 'District of Columbia', 'Washington');
结果
44
- 在“Washington”城市有44次浏览。
StatsFinder服务提供了您可以浏览的其他功能。
使用 "Google Charts" 构建图表
现在您可以使用这些统计数据来构建图表,如下所示
2018年每月浏览量统计
此外,您可以根据统计数据文件中的数据,在每日视图、每小时视图、每周视图和每年视图上构建图表。
关于“Google Charts”的更多信息,请参阅此处
StatsComputer 服务
使用StatsComputer服务来计算统计数据的最小值、最大值、平均值、范围值、众数、中位数以及统计数据出现的次数
首先,获取统计计算服务
$statsComputer = $this->get('tchoulom.viewcounter.stats_computer');
statsComputer服务的功能可以将以下参数作为参数:$yearlyStats、$monthlyStats、$weeklyStats、$daylyStats、$hourlyStats、$statsPerMinute和$statsPerSecond
计算最小值
// Get the min value of the yearly statistics $minValue = $statsComputer->computeMinValue($yearlyStats);
结果
[2017,47882376]
计算最大值
// Get the max value of the monthly statistics $maxValue = $statsComputer->computeMaxValue($monthlyStats);
结果
[8,951224]
计算平均值
平均值是统计数据系列值的总和除以值的数量。
// Get the average of the weekly statistics $average = $statsComputer->computeAverage($weeklyStats);
结果
265039
计算范围
范围是最高值和最低值之间的差值。
// Get the range of the daily statistics $range = $statsComputer->computeRange($dailyStats);
结果
6
计算众数
众数是数组中出现次数最多的数字。
// Get the mode of the hourly statistics $mode = $statsComputer->computeMode($hourlyStats);
结果
700
计算中位数
中位数是在将数字从小到大排序后中间的值。
// Get the median of the statistics per minute $median = $statsComputer->computeMedian($statsPerMinute);
结果
75.5
统计序列中的值数量
// Get the count of the statistics per second $count = $statsComputer->count($statsPerSecond);
结果
60
工具
命令
清理 viewcounter 数据
您可以使用ViewcounterCleanupCommand命令删除视图计数器数据
- 从数据库中删除所有视图计数器数据
php bin/console tchoulom:viewcounter:cleanup
- 删除所有至少1小时前查看的文章的视图计数器数据
php bin/console tchoulom:viewcounter:cleanup --min=1h
- 删除所有最多1天前查看的文章的视图计数器数据
php bin/console tchoulom:viewcounter:cleanup --max=1d
- 删除所有至少3年前查看的文章的视图计数器数据
php bin/console tchoulom:viewcounter:cleanup --min=3y
- 删除所有最多5个月前查看的文章的视图计数器数据
php bin/console tchoulom:viewcounter:cleanup --max=5M
- 日期间隔示例
's' => 'second'
'm' => 'minute'
'h' => 'hour'
'd' => 'day'
'w' => 'week'
'M' => 'month'
'y' => 'year'
原始信用
由Ernest TCHOULOM创建,用于tchoulom.com
许可
此包在MIT许可下发布。请参阅包中的完整许可证
LICENSE
祝您玩得开心!
需要帮助或发现错误?请访问http://www.tchoulom.com