嗨,我真的找不到答案。我有几个变量想在 preg_match 中使用,但我只能使用一个变量。
我的代码是:
function imagetoday(){
global $imagetoday;
if(preg_match_all('/rain.png/', $imagetoday)){
echo '<img src="assets/img/rain.png" class="img-responsive week" alt="Responsive image">';
}
if(preg_match('/light_rain.png/', $imagetoday)){
echo '<img src="assets/img/light_rain.png" class="img-responsive week" alt="Responsive image">';
}
if(preg_match('/partly_cloudy.png/', $imagetoday)){
echo '<img src="assets/img/partly_cloudy.png" class="img-responsive week" alt="Responsive image">';
}
}
我试着用
if(preg_match('/light_rain.png/', $imagetoday, $imageday2, imageday3, $imageday4)){
echo '<img src="assets/img/light_rain.png" class="img-responsive week" alt="Responsive image">';
}
但不工作有人可以帮我吗?谢谢!