尝试获取url中的日期
upload/Standard Project/test/04-12-2011/1.jpg
url将更改名称,日期也将更改,但格式始终相同。
知道怎么做就太好了。我试图使用substr来确定日期,但意识到这是行不通的,因为url可以改变。
<?php
$str = 'upload/Standard Project/test/04-12-2011/1.jpg';
if(preg_match('@/([0-9]{2}-[0-9]{2}-[0-9]{4})/@', $str, $matches))
var_dump($matches[1]);