错误:在PHP

时间:2017-02-12 19:42:48

标签: php

在我的程序中遇到PHP静态函数的问题。我的代码在下面,我不断收到错误“预期的匿名函数”。我正在使用IDE PhpStorm。

我有一个谷歌但没有出现。如果我删除了函数的名称,则错误消失,但我不知道如何调用该函数。

<?php

/**
 * @param mysqli $conn Connection to the database.
 * @param int $id The ID of the white card that is to be voted up.
 */
public static function voteUp($conn, $id){
    mysqli_query($conn, 'UPDATE WhiteCards SET Ups = Ups + 1 WHERE ID = ' . $id);
}

/**
 * @param mysqli $conn Connection to the database.
 * @param int $id The ID of the white card that is to be voted down.
 */
public static function voteDown($conn, $id){
    mysqli_query($conn, 'UPDATE WhiteCards SET Ups = Ups - 1 WHERE ID = ' . $id);
}

1 个答案:

答案 0 :(得分:2)

刚刚解决了它,这两个函数需要在一个类中。