0
안녕하세요. 저는 답변을 찾을 수 없습니다. 나는 preg_match에서 사용할 변수를 하나 가지고 있지만 변수 하나만 사용할 수 있습니다.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">';
}
을 사용하려하지만 나던 작품은 누군가가 제발 도와 드릴까요? 감사! 이 같은
. 그 정의에 대해 [the docs] (http://php.net/preg_match)를 읽으십시오. //이 예제에서는 실제로 정규 표현식을 사용하지 않습니다. 당신은 ['strpos()'] (http://php.net/strpos)와 같은 것으로 충분할 것 같은 간단한 문자열 검색을하고있는 것입니다. // 정규 표현식을 결합하고 싶다면 파이프 기호'|'([alternation] (http://www.regular-expressions.info/alternation.html)) 사용법을 배우십시오. – Wiseguy
정확히 무엇을 성취하려고합니까? 특정 문자열이 여러 변수 중 하나에 있는지 확인하십시오. – Wiseguy