在第151行获取PHP语法错误“意外的T_FOREACH”

时间:2015-03-20 04:32:23

标签: php

我在foreach构造的第151行收到错误,我不知道为什么? 解析错误:语法错误,意外' foreach'第150行的engine \ inc \ video_part.php中的(T_FOREACH)

    $save_con                  = $_POST['save_con'];
    $save_con['on_off']        = intval($save_con['on_off']);
    $save_con['full_or_field'] = intval($save_con['full_or_field']);
    $save_con['nav_mod']       = intval($save_con['nav_mod']);
    $save_con['next_prev']     = intval($save_con['next_prev']);
    $save_con['ajax_nav']      = intval($save_con['ajax_nav']);
    $save_con['prefix']        = $save_con['prefix'];
    $save_con['fields']        = $save_con['fields']; 



  $find    = array();
    $replace = array();

    $find[]    = "'\r'";
    $replace[] = "";
    $find[]    = "'\n'";
    $replace[] = "";

    $handler = fopen(ENGINE_DIR . '/data/video_part_config.php', "w");

    fwrite($handler, "<?PHP \n\n//Video Part System by MaRZoCHi & Gameer\n\n\$video_part_config = array (\n\n'version' => \"2.5\",\n\n");
    foreach ($save_con as $name => $value) {             <- line 151 error


        fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
    }
    fwrite($handler, ");\n\n?>");
    fclose($handler);

    clear_cache();
    msg("info", $lang['opt_sysok'], "<font color=\"green\"><b>{$lang['opt_sysok_1']}</b></font>", "$PHP_SELF?mod=video_part");
}

?>

1 个答案:

答案 0 :(得分:0)

在此行中勾选括号,

fwrite($handler, "<?PHP \n\n//Video Part System by MaRZoCHi & Gameer\n\n\$video_part_config = array (\n\n'version' => \"2.5\",\n\n");

fwrite($handler, "<?PHP \n\n//Video Part System by MaRZoCHi & Gameer\n\n\$video_part_config = array (\n\n'version' => \"2.5\",\n\n"));