【发布时间】:2016-06-03 20:36:07
【问题描述】:
我需要一些帮助来修复我的代码。我环顾四周,无法让它工作。以下是我收到的错误消息:
警告:file_get_contents() [function.file-get-contents]:无法解析第 13 行 /home/a9317671/public_html/prox/get.php 中的主机名
警告:file_get_contents(http://http://ben-nottelling.comlu.com/) [function.file-get-contents]:无法打开流:第 13 行 /home/a9317671/public_html/prox/get.php 中的操作失败
我的代码:
<!DOCTYPE html>
<html>
<body>
<form name='form' method='post' action="get.php">
ULR (no https/https): <input type="text" name="name" id="name" ><br/>
<input type="submit" name="submit" value="Submit">
</body>
</html>
还有get.php 代码(这是出现问题的地方):
<?php
$length = 10;
$fname= substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
$name = $_GET['name'];
echo $name;
echo "The is a test. File will be at: http://ben-nottelling.comlu.com/prox/$fname.html";
file_put_contents($fname.html, file_get_contents("http://http://ben-nottelling.comlu.com/"));
?>
【问题讨论】:
-
你在字符串中加倍了
http://协议。 -
我将此标记为“一个简单的印刷错误”,因为主机是作为文字传递的,并且该修复程序不太可能在将来帮助任何人。