Php require once在响应中添加新行
我有以下PHP类代码:Php require once在响应中添加新行,php,Php,我有以下PHP类代码: <?php require_once CUSTOM_PATH . DIRECTORY_SEPARATOR . 'myneighborlists.php'; class Action_Get_route extends Frapi_Action implements Frapi_Action_Interface { /** * Required parameters * * @var An array of requir
<?php
require_once CUSTOM_PATH . DIRECTORY_SEPARATOR . 'myneighborlists.php';
class Action_Get_route extends Frapi_Action implements Frapi_Action_Interface
{
/**
* Required parameters
*
* @var An array of required parameters.
*/
protected $requiredParams = array();
/**
* The data container to use in toArray()
*
* @var A container of data to fill and return in toArray()
*/
private $data = array();
/**
* To Array
*
* This method returns the value found in the database
* into an associative array.
*
* @return array
*/
public function toArray()
{
//$this->data['origin'] = $this->getParam('origin', self::TYPE_OUTPUT);
//$this->data['destination'] = $this->getParam('destination', self::TYPE_OUTPUT);
return $this->data;
}
/**
* Default Call Method
*
* This method is called when no specific request handler has been found
*
* @return array
*/
public function executeAction()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
/**
* Get Request Handler
*
* This method is called when a request is a GET
*
* @return array
*/
public function executeGet()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
/**
* Post Request Handler
*
* This method is called when a request is a POST
*
* @return array
*/
public function executePost()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
/**
* Put Request Handler
*
* This method is called when a request is a PUT
*
* @return array
*/
public function executePut()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
/**
* Delete Request Handler
*
* This method is called when a request is a DELETE
*
* @return array
*/
public function executeDelete()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
/**
* Head Request Handler
*
* This method is called when a request is a HEAD
*
* @return array
*/
public function executeHead()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
return $this->toArray();
}
}
查看所需文件中的关闭标记后是否有额外的行或空格。所需文件中可能有某个内容在回显空格/行,或者文件末尾有额外的空格。如果不查看myneightrlists.php的源代码,很难回答此问题。我的猜测是,在检查myneightrlists.php之前,这个文件的顶部有一个空行。可能在
之前有一个额外的换行符。值得注意的是,PHP结束标记?>
在文件末尾总是可选的。通过省略它,您可以将出现此问题的可能性减半。我非常确定它是文件末尾的空白字符+解决方案为1,metalmatriarch.com参考为+1;)