我正在使用GoDaddy的CPanel托管并刚刚在本地开发了一个提交网站,但是当我将其上传到服务器时,它不会显示index.php文件的正文。 / p>
我不认为它与index.php文件有关,因为在本地主机上使用Wamp本地工作正常但是我的CPanel服务器将拒绝工作。 http://submit.arhsj.com/是index.php的所在。您可以看到页面标题已更改,您可以检查元素以查看头部包含的东西,但是正文是空的。
以下是submit.arhsj.com文件夹中的文件。
如果您认为有必要,我可以提供更多信息。我真的很困惑,为什么它在localhost上完美运行时无法正常工作。即使是2个PHP部分中间的HTML表单也不会显示。
index.php代码:
<!DOCTYPE html>
<html>
<head>
<title>Submission Website</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<?php
require('/recaptcha/src/autoload.php');
require_once "recaptchalib.php";
$siteKey = 'XXXXXXXXXXXXXX';
$secret = 'XXXXXXXXXXXXX';
$lang = 'en';
$response = null; // empty response
$reCaptcha = new ReCaptcha($secret); // check secret key
if (isset($_POST['g-recaptcha-response'])) { // if submitted check response
$response = $reCaptcha->verifyResponse(
$_SERVER['REMOTE_ADDR'],
$_POST['g-recaptcha-response']
);
}
if ($response != null && $response->success) {
echo "Thanks for your submission!";
} else {
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
Select image to submit*:
<input type="file" accept=".gif,.png,.jpg,.jpeg" name="submission" id="submission" required>
<br>Allowed file types: .png .jpg .jpeg .gif
<br><input type="text" name="first_name" id="first_name" placeholder="First Name*" maxlength="56" required>
<br><input type="text" name="last_name" id="last_name" placeholder="Last Name*" maxlength="56" required>
<br><input type="text" name="email" id="email" placeholder="Email Address*" maxlength="128" required>
<br><input type="checkbox" id="rights" value="rights" required>I created this meme or found this meme online but have not changed anything (such as removing watermarks).
<br><input type="checkbox" id="age" value="rights" required>I am 13 years of age or older.
<br><br>By clicking "Submit", you have read, accepted, and agreed to adhere to our Terms of Submission.
<div class="g-recaptcha" data-sitekey="XXXXXXXXXXXXXX"></div>
<input type="submit" value="Submit" name="submit">
<br><br>* Required
</form>
<?php
}
?>
</body>
</html>
答案 0 :(得分:0)
如果谁发帖给出一些答案,也许有人可以帮助他,但这里semms成为了一个&#34; 最后的机会&#34; :)
页面崩溃了,确定如何从php代码中崩溃。
也许代码以不可见的字节顺序标记(BOM)开头。因此,尝试使用编辑器或记事本++打开,将编码设置为UTF-8(无BOM)。其他问题可能是路径,所以需要尝试这种方式,如果工作,你可以检查原因。
require $_SERVER['DOCUMENT_ROOT'] . '/recaptcha/src/autoload.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/recaptchalib.php';
无论如何,重复这一点,如果您发布尝试按照回复可能有人可以帮助您。