我得到了这个代码
$title = new FullName($reservation->Title, $reservation->Description)
它在一个框中显示值 Title 和 Description ,但它是直接相互跟随的。当盒子太小时,它会换行,但只在盒子末端的确切点。那么如何在 $reservation->Title 和 $reservation->Description 之间强制换行?
这是全名类
class FullName
{
/**
* @var string
*/
private $fullName;
public function __construct($firstName, $lastName)
{
$formatter = Configuration::Instance()->GetKey(ConfigKeys::NAME_FORMAT);
if (empty($formatter))
{
$this->fullName = "$firstName $lastName";
}
else
{
$this->fullName = str_replace('{first}', $firstName, $formatter);
$this->fullName = str_replace('{last}', $lastName, $this->fullName);
}
}
public function __toString()
{
return $this->fullName;
}
}