为什么我找不到这个语法错误?

时间:2019-04-15 12:31:20

标签: php

我一直在这里的所有人和大约3个php教程的帮助下编写此代码。运行代码时,出现第70行(倒数第二个大括号})的语法错误。它说括号是出乎意料的,但我不知道为什么...

<?php

//defining function
function splitOne($V){

    //split array into smaller arrays
    array_chunk($data, 1);
    print_r($data);

    //map thumb part of array
    $thumb = array_map(str_getcsv($data[5], ";"));
    print_r($thumb);

    //map keyword part of array
    $keyword = array_map(str_getcsv($data[6], ";"));
    print_r($keyword);

    //remove last two fields of data
    array_pop($data);
    array_pop($data);

    //merge arrays 
    $v = array_merge($data, $thumb, $keyword);

    //return new array from function
    return $v;

}

//Connecting to database
$mysqli = new mysqli("localhost", "root", "password", 
"Studios");

//field Check
print_r("Connection Established");

//Scanning Directory
$dollar = glob("C:\Users\user\Desktop\CVS\XH\*.CSV");

//field Check
print_r("Data Collected" + $dollar);

foreach($dollar as $value) {
    while (($data = fgetcsv($dollar, 1002, "|")) !== FALSE){

        //remove first field
        $fruit = array_shift($data);
        print_r($data);

        //remove last string
        array_pop($data);
        print_r($data);

        //remove last string again
        array_pop($data);
        print_r($data);

        //remove last string a third time
        array_pop($data);
        print_r($data);

        //mapping array into function to manipulate
        array_map(splitOne, $data);


        $query = "INSERT INTO Quarantine (Url, 
EmbedUrl, Title, Duration, DateAdded, Thumb1, Thumb2, 
Thumb3, Thumb4, Thumb5, Thumb6, Thumb7, Thumb8, 
Thumb9, Thumb10, Keyword1, Keyword2, Keyword3, 
Keyword4, Keyword5, Keyword6, Keyword7, Keyword8, 
Keyword9, Keyword10) VALUES($V)";

        mysqli_query($conn, $query);
        //Field Check
        print_r("Data Entered Into Quarantine")
    }
}

?>

我正在Windows 7上运行本地Wamp服务器。

1 个答案:

答案 0 :(得分:-1)

print_r("Data Entered Into Quarantine")

应为==>

print_r("Data Entered Into Quarantine");

您想念Patrick Q所说的分号