我有一个包含2个函数的类。我想在其他函数中使用其中一个函数。两个公共职能。这可能吗?我无法让它发挥作用。
这是我的班级:
class scores {
public function rightScoreTicks($idMatch, $currentScores)
{
include('commonItems/connectionMundial.php');
$rightScores = "SELECT * FROM partidos WHERE ganador <> 0 AND id = ".$idMatch;
$resultRight = $con->prepare($rightScores);
$resultRight->execute();
$rightScore = $resultRight->fetchAll();
if ($rightScore[0]['ganador'] != 0)
{
//echo " | (Resultado final: ".$rightScore[0]['score1']." - ".$rightScore[0]['score2'].")";
if ($rightScore[0]['ganador'] == $currentScores[0]['ganador'])
$rightProno = "<font style='color: green;'><strong>✔</strong></font>";
else $rightProno = "<font style='color: red;'><strong>✘</strong></font>";
if ($rightScore[0]['score1'] == $currentScores[0]['team1'] && $rightScore[0]['score2'] == $currentScores[0]['team2'] )
$exactScore = "<font style='color: green;'><strong>✔</strong></font>";
else $exactScore = "<font style='color: red;'><strong>✘</strong></font>";
echo " ".$rightProno." ".$exactScore;
}
}
public function allPlayersProno ($idMatch, $idPlayer2, $bettingActive)
{
include('commonItems/connectionMundial.php');
$allpron = "SELECT * FROM predictions WHERE id_partido = ".$idMatch;
$allPronos = $con->prepare($allpron);
$allPronos->execute();
$allPronosticos = $allPronos->fetchAll();
foreach ($allPronosticos as $eachProno)
{
$playerName2 = playerDetails($eachProno['id_usuario']);
if ($eachProno['ganador'] != 0 && $eachProno['id_usuario'] != $idPlayer2)
{
echo "<br><span style='font-size: 12px; color: #0F753F;'>".$playerName2.": ".$eachProno['team1']." - ".$eachProno['team2'];
$this->rightScoreTicks($comingMatch['id'], $pronoJugad);
echo "</span>";
}
}
}
}
我在函数allPlayersProno
中尝试$this->rightScoreTicks($comingMatch['id'], $pronoJugad);