我遇到了一個非常奇怪的問題。一切工作正常我的本地主機上。當我上傳到實時服務器時,該頁面正好切斷了包含文件的位置。只是在它下面的空白空間。納達...當包括一個文件,分頁符
,打破該生產線是:
<? require_once('inc/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>
而且要包含的文件是:
<?php
/*///////////////////////////////////////////////////////////////////////
Part of the code from the book
Building Findable Websites: Web Standards, SEO, and Beyond
by Aarron Walter ([email protected])
http://buildingfindablewebsites.com
Distrbuted under Creative Commons license
http://creativecommons.org/licenses/by-sa/3.0/us/
///////////////////////////////////////////////////////////////////////*/
function storeAddress(){
// Validation
if(!$_GET['email']){ return "No email address provided"; }
if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $_GET['email'])) {
return "Email address is invalid";
}
require_once('MCAPI.class.php');
// grab an API Key from http://admin.mailchimp.com/account/api/
$api = new MCAPI('xxxxxxx');
// grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
// Click the "settings" link for the list - the Unique Id is at the bottom of that page.
$list_id = "xxxxxx";
if($api->listSubscribe($list_id, $_GET['email']) === true) {
// It worked!
// return 'Success! Thank You!';
echo '<script> window.location.href = "thank-you.php"; </script>';
}
else
{
// An error ocurred, return error message
return 'Error: ' . $api->errorMessage;
}
}
// If being called via ajax, autorun the function
if($_GET['ajax']){ echo storeAddress(); }
?>
在上面的代碼編輯的唯一的事情就是API密鑰和列表ID 。
你看過錯誤日誌嗎? – RiggsFolly
這聽起來像一個不顯示的PHP錯誤。看看error_reporting/display_erros php-options。 – giraff
MCAPI.class.php文件是否存在於同一目錄中? –