1
,如果我有UUID現在會出來這樣42f704ab4ae141c78c185558f9447748但有可能讓它串在這42f704ab-4ae1-41c7-8c18-5558f9447748所以用在某些地方破折號PHP添加幾許解碼
<?php
$playername = 'Vanture';
$url = "https://api.mojang.com/users/profiles/minecraft/" . urlencode($playername);
$result = file_get_contents($url);
$json = json_decode($result);
if ($json == NULL) {
echo("NULL returned - probably invalid playername");
} else {
$UUID = $json->id;
echo "$UUID $playername";
}
?>
不與解碼。它只是一個字符串,所以使用字符串工具來操縱它。 –