统一php WWW不起作用

时间:2016-05-15 11:51:24

标签: c# php unity3d

我想用统一的php更新我的分数

我有 session_score.php

<?php
//session_score.php

session_start(); 

$score = $_REQUEST['score'];
$userid = $_SESSION['userid'];

if (!isset($_SESSION['userid'])) return;


$mysqli = new mysqli("127.0.0.1", "graduate", "bitnami", "my_game");
$sql = "update UserAccount set score=$score where userid='$userid';";
$result = $mysqli->query($sql) or die("first query error");

$sql = "select userid, score from UserAccount;";
$result = $mysqli->query($sql) or die("second query error");

while ($row = $result->fetch_object())
{
    echo"{$row->userid} : {$row->score}\n";
}

?>

这是附加到UI按钮的统一C#代码

int score;
public void Score()
{
    WWWForm form = new WWWForm();
    form.AddField("score", score);
    WWW w = new WWW("http://localhost/session_score.php", form);
}

当我点击按钮时,分数不会更新.. 我不知道原因 请帮忙..

0 个答案:

没有答案