大家好,我只是想问一下如何在PHP 中制作以下代码
<input type="text" name="SteamID64">
当用户输入并点击按钮时,它应该在下面的中填写该值
<?php
$xml=simplexml_load_file("http://steamcommunity.com/profiles/<STEAMID64 HERE>?xml=1");
echo $xml->steamID . "<br>";
echo $xml->onlineState . "<br>";
echo $xml->privacyState . "<br>";
echo $xml->avatarFull . "<br>";
echo $xml->body;
?>
很抱歉,如果我做错了这个问题,我是新来的
使用$_POST
获取id:
$format = "http://steamcommunity.com/profiles/%s?xml=1";
$url = sprintf($format, $_POST["SteamID64"]);
$xml=simplexml_load_file($url);
我假设你已经正确设置了表格,比如:
<form action="TheTarget.php" method="post">
<input type="text" name="SteamID64" />
<input type='submit' value='submit' />
</form>
if (isset($_POST['SteamID64'])) {
$id = $_POST['SteamID64'];
$xml = simplexml_load_file("http://steamcommunity.com/profiles/{$id}?xml=1");
}