Php 包含文件时,分页符

Php 包含文件时,分页符,php,mailchimp,Php,Mailchimp,我遇到了一个非常奇怪的问题。在我的本地主机上一切正常。当我上传到一个实时服务器时,页面就在我包含文件的地方被切断。只是它下面的空白。娜达 断开的线是: <? require_once('inc/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?> 包括的文件是: <?php /*/////////////////////////////////////////////////////////

我遇到了一个非常奇怪的问题。在我的本地主机上一切正常。当我上传到一个实时服务器时,页面就在我包含文件的地方被切断。只是它下面的空白。娜达

断开的线是:

<? 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 (aarron@buildingfindablewebsites.com)
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(); }
?>

其原因是您的if条件缺少父项

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

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

好像有个错误。它在我的本地服务器上工作,因为没有错误

我在用filezilla上传我的内容。由于某些原因,在上载时似乎存在编码问题

我不知道我是否应该删除这个问题或答案来帮助其他人解决这个问题,所以我选择了后者


我手动上传了我的文件,猜猜看,它工作了

你看过错误日志了吗???这听起来像是一个没有显示的PHP错误。查看错误报告/显示错误php-options.MCAPI.class.php文件是否存在于同一目录中?我现在正在查找错误日志。可能是本地主机和服务器之间的文件夹体系结构差异,也可能是权限问题。在“inc”文件夹上执行“ls-la”,如果apache没有读取/执行权限,则执行“chown www data”。当您在inc文件夹中时,我认为这只是一个输入错误,因为他们声称它在另一个系统上工作。但你可能是对的。打字错误很抱歉我修复了它,所以您可以看一下并比较这两个php.ini文件。我的som问题实际上是错误的配置。你也应该看看这里,希望它能帮助你谢谢。我下一步肯定会调查的。问题是,几周前我用这个方法做了一个项目(事实上是同一个脚本),它在我的live服务器上运行得很好。(同一台服务器)既然您决定将问题保留在这里,请接受您自己的答案。这样,您的问题将从“未回答”列表中删除。