我在这里有这个字符串,当我执行 str_replace 时,photo of the day - 2011
我需要看起来像这样,我得到这个输出:photo-of-the-day-2011
photo-of-the-day---2011
我该怎么做才能解决这个问题?
这是代码:
$albumName = 'photo of the day - 2011'; (this comes from a db and cannot change it)
$albumName = str_replace(" ", "-", $albumName);