我使用GoDaddy的CPanel託管,並在本地完成開發提交網站,但是當我將其上傳到服務器時,它不會顯示index.php文件的主體。服務器不會顯示HTML或PHP的身體
我不認爲它與index.php文件有關,因爲在本地使用Wamp在localhost上工作正常,但是我的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>
您試圖刪除php代碼? –
你的代碼被替換爲[this](https://gyazo.com/8189d48c148e709fe50939fb24540148),你有沒有檢查過你的日誌? – Script47
@ Script47不會被代替,只是在啓動php代碼時被阻止。 –