获取这些错误。
不推荐使用:自动填充$ HTTP_RAW_POST_DATA已弃用,将在以后的版本中删除。为了避免这种警告,请设置“always_populate_raw_post_data'到' -1'在php.ini中使用php://输入流代替。在第0行的未知中
警告:无法修改标题信息 - 已在第0行的“未知”中发送的标题
我的代码:
<!DOCTYPE html>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="jumbotron text-center">
<h1>My First Bootstrap Page</h1>
<p>Resize this responsive page to see the effect!</p>
</div>
<form method="post" class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="site">Site:</label>
<div class="col-sm-10">
<input name="site_input" type="text" class="form-control" id="site" placeholder="Enter site">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" value="getResponse" name="submitButton" name="submitButton" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</body>
</html>
<?php
function checkName($username){
$curl = curl_init();
if ($curl == false){
echo "Failed to initialize";
}
$timeout = 5;
curl_setopt($curl, CURLOPT_URL, 'https://api.mojang.com/users/profiles/minecraft/'.$username);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
$output = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($status == "204"){
echo "<div align=center>".$username."is available!</div>";
}else{
echo "Name unavailable!";
}
}
if (isset($_POST['submitButton'])){
checkName($_POST['site_input']);
}
?>
非常感谢任何帮助。我尝试将设置调整为-1,如上所述。