안녕하세요 저는 다음과 같은 오류를 받고 있어요 오프셋PHP 오류 공지 사항 : 정의되지 않은이
Notice: Undefined offset: 1 in file.php on line 113
라인 113 $입니다 publish_content = $ matches2 [1]
이것은이 배열 변수 $matches1
나던 1
키가 포함되어 있음을 의미 내 코드
if(!preg_match('/\<content\:encoded\>(?:\<\!\[CDATA\[)?(.*?)(?:\]\]\>)?\<\/content\:encoded\>/si',$item,$matches2)){
for($i2=0;$i2<count($info_tag_pairs);$i2++){
if(preg_match('/'.custom_preg_quote($info_tag_pairs[$i2][0]).'(.*?)'.custom_preg_quote($info_tag_pairs[$i2][1]).'/si',$item,$matches2)){
break;
}
}
}
$publish_content=$matches2[1];
$publish_content=strip_tags($publish_content);
$publish_content=preg_replace('/'.arrayToString($rkws,'|','custom_preg_quote').'/si','',$publish_content);
$publish_content=trim($publish_content);
//echo $item;
if(!preg_match_all('/\<category\>(?:\<\!\[CDATA\[)?(.*?)(?:\]\]\>)?\<\/category\>/si',$item,$matches2)){
for($i2=0;$i2<count($category_tag_pairs);$i2++){
if(preg_match_all('/'.custom_preg_quote($category_tag_pairs[$i2][0]).'(.*?)'.custom_preg_quote($category_tag_pairs[$i2][1]).'/si',$item,$matches2)){
break;
}
}
}
** 줄이있는 곳 113 ** ** – ajreal
변수 내용은 무엇입니까? – Alex
dodgy regexps로 싸우는 대신 실제 XML 파서를 사용하도록 코드를 변경하는 것이 좋습니다. – Boann