2015-06-18 49 views
0

我遇到了一個非常奇怪的問題。一切工作正常我的本地主機上。當我上傳到實時服務器時,該頁面正好切斷了包含文件的位置。只是在它下面的空白空間。納達...當包括一個文件,分頁符

,打破該生產線是:

<? 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 。

+0

你看過錯誤日誌嗎? – RiggsFolly

+2

這聽起來像一個不顯示的PHP錯誤。看看error_reporting/display_erros php-options。 – giraff

+0

MCAPI.class.php文件是否存在於同一目錄中? –

回答

0

看起來有錯誤。它正在我的本地服務器上工作,因爲沒有錯誤。

我正在使用filezilla做上傳我的內容。出於某種原因,上傳時似乎是編碼問題。

我不知道我是否應該刪除此問題或答案,以便稍後幫助其他人解決問題,所以我選擇了後面的問題。

我手動上傳了我的文件並猜測它是什麼,它的工作原理!

+0

既然你確實決定讓你的問題在這裏,請接受你自己的答案。這樣,您的問題將從「未答覆」列表中刪除。 – kittykittybangbang

0

它的因爲缺少parentesis您的條件。

require_once('inc/store-address.php'); 

if($_GET['submit'] **)** { 
    echo storeAddress(); 
} 
+0

我認爲這只是一個錯字,因爲他們聲稱它在另一個系統上工作。但你可能是對的。 。 – RiggsFolly

+1

Typo。抱歉。我修好了它。 – jds

+0

所以你可以看看並比較兩個php.ini文件。我有些問題,其實是錯誤的配置。 你也應該看看這裏http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size,希望它可以幫助你 –