내가 프로젝트 PHP 날씨 2.2.2를 사용하고 싶지만 많은 문제가 여기: 통지 오프셋 undefined가 : 2
function get_languages($type) {
static $output = array();
if (empty($output)) {
/* I use dirname(__FILE__) here instead of PHPWEATHER_BASE_DIR
* because one might use this function without having included
* phpweather.php first. */
require(dirname(__FILE__) . '/languages.php');
$dir = opendir(dirname(__FILE__) . '/output');
while($file = readdir($dir)) {
// I got a problem in this line below
if (ereg("^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$", $file, $regs)) {
// After i change it to the line mentioned below i got error undefined offset:2 in line 2 mentioned below
// how to correct this error or is there any way to correct this code
if(preg_match("#^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$#", $file, $regs)) {
$output[$regs[1] . $regs[2]] = $languages[$regs[1] . $regs[2]];
}
}
closedir($dir);
}
asort($output);
return $output;
}
$ regs [2]이 (가) 확실합니까? – Joshua
'var_dump ($ regs);'당신은 답을 얻을 것입니다. – Rikesh
도와 주셔서 고맙습니다 :) – user1991