【发布时间】:2019-09-05 23:05:43
【问题描述】:
好的,我正在使用库从 X 网站获取一些字符串,这个字符串看起来像:
2019 年 3 月 17 日,欧洲中部时间 16:08:43,被加兹哈拉苟斯死于 418 级。
if($player->getDeaths()) {
$mystring = $player->getDeaths()[0];
$dateString = preg_replace("/\([^)]+\)/","",$mystring);
$date = new DateTime($dateString);
echo $date->format('Y-m-d H:i:s');
}
这就是我的代码现在的样子,我怎样才能只得到“Mar 17 2019, 16:08:43”?
谢谢!
【问题讨论】:
标签: php regex-negation